SuperLearner

class falcon.tabular.learners.SuperLearner(task: str, base_estimators: Optional[List[Tuple[str, Callable, Dict]]] = None, base_score_threshold: Optional[float] = None, cv: Optional[Any] = None, filter_estimators: Optional[bool] = None)

Tabular learner which employs StackingModel for construction of meta estimator.

__init__(task: str, base_estimators: Optional[List[Tuple[str, Callable, Dict]]] = None, base_score_threshold: Optional[float] = None, cv: Optional[Any] = None, filter_estimators: Optional[bool] = None) None

Constructs a meta model which is trained on cross-validated predictions of base estimators.

Parameters
  • task (str) – tabular_classification or tabular_regression

  • base_estimators (Optional[List[Tuple[str, Callable, Dict]]], optional) – list of base estimators, by default None

  • base_score_threshold (Optional[float], optional) – threshold for filtering of the estimators, by default None

  • cv (Any, optional) – number of CV folds or CV custom object, by default None

  • filter_estimators (Optional[bool], optional) – when True, the perfomance of the estimators pre-estimated on the subset of training, estimators with the performance below the threshold will not be used for meta model construction, by default None

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

Fits the model. The hyperparameters that were not passed to the __init__ will be automatically determined based on the size of the training set. 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: ndarray[Any, dtype[float32]], *args: Any, **kwargs: Any) Union[ndarray[Any, dtype[float32]], ndarray[Any, dtype[int64]]]

Equivalen to .predict(X)

Parameters

X (Float32Array) – features

Returns

predictions

Return type

Union[Float32Array, Int64Array]

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]]]

Makes a prediction for given X.

Parameters

X (Float32Array) – features

Returns

predictions

Return type

Union[Float32Array, Int64Array]

to_onnx() SerializedModelRepr

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

Return type

SerializedModelRepr