PlainLearner

class falcon.tabular.learners.PlainLearner(task: str, model_class: Optional[Type] = None, hyperparameters: Optional[Dict] = None, **kwargs: Any)

PlainLearner trains a model using provided or default hyperparameters.

__init__(task: str, model_class: Optional[Type] = None, hyperparameters: Optional[Dict] = None, **kwargs: Any) None
Parameters
  • task (str) – ‘tabular_classification’ or ‘tabular_regression’

  • model_class (Optional[Type], optional) – the class of the model to train, by default None; if None, HistGradientBoosting is used

  • hyperparameters (Dict, optional) – the dictionary of hyperparameters for model training

fit(X: ndarray[Any, dtype[float32]], y: ndarray[Any, dtype[float32]], *args: Any, **kwargs: Any) None

Fits the model and trains the final model using them. For classification tasks, the dataset will be balanced by upsampling the minority class(es).

Parameters
  • X (Float32Array) – features

  • y (Float32Array) – targets

fit_pipe(X: ndarray[Any, dtype[float32]], y: ndarray[Any, dtype[float32]], *args: Any, **kwargs: Any) None

Equivalent to .fit(X, y)

Parameters
  • X (Float32Array) – features

  • y (Float32Array) – targets

forward(X: Any, *args: Any, **kwargs: Any) Any

Equivalent of predict method that is used for elements chaining inside pipeline during inference.

Parameters

X (Any) – featrues

Returns

predictions

Return type

Any

get_input_type() Type
Returns

Float32Array

Return type

Type

get_output_type() Type
Returns

Float32Array for regression, Int64Array for classification

Return type

Type

predict(X: ndarray[Any, dtype[float32]], *args: Any, **kwargs: Any) Union[ndarray[Any, dtype[float32]], ndarray[Any, dtype[int64]]]
Parameters

X (npt.NDArray) – features

Returns

predictions

Return type

npt.NDArray

to_onnx() SerializedModelRepr

Serializes the underlying model to onnx by calling its .to_onnx() method.

Return type

SerializedModelRepr