lale.lib.sklearn.stacking_regressor module

class lale.lib.sklearn.stacking_regressor.StackingRegressor(*, estimators, final_estimator=None, cv=5, n_jobs=None, passthrough=False)

Bases: PlannedIndividualOp

Stacking regressor from scikit-learn for stacking ensemble.

This documentation is auto-generated from JSON schemas.

Parameters
  • estimators (array) –

    Base estimators which will be stacked together. Each element of the list is defined as a tuple of string (i.e. name) and an estimator instance. An estimator can be set to ‘drop’ using set_params.

    • items : tuple

      • item 0 : string

      • item 1 : union type

        • operator

        • or None

  • final_estimator (union type, default None) –

    A regressor which will be used to combine the base estimators. The default classifier is a ‘RidgeCV’

    • operator

    • or None

  • cv (union type, default 5) –

    Determines the cross-validation splitting strategy used in cross_val_predict to train final_estimator.

    • union type

      • integer, >=2, >=3 for optimizer, <=4 for optimizer, uniform distribution, default 5

        Number of folds for cross-validation.

      • or None, not for optimizer

        to use the default 5-fold cross validation

    • or ‘prefit’, not for optimizer

      ”prefit” to assume the estimators are prefit. In this case, the estimators will not be refitted.

    • or CrossvalGenerator, not for optimizer

      Object with split function: generator yielding (train, test) splits as arrays of indices. Can use any of the iterators from https://scikit-learn.org/stable/modules/cross_validation.html#cross-validation-iterators

  • n_jobs (union type, not for optimizer, default None) –

    The number of jobs to run in parallel for fit.

    • integer

    • or None

  • passthrough (boolean, default False) – When False, only the predictions of estimators will be used as training data for ‘final_estimator’. When True, the ‘final_estimator’ is trained on the predictions as well as the original training data.

fit(X, y=None, **fit_params)

Train the operator.

Note: The fit method is not available until this operator is trainable.

Once this method is available, it will have the following signature:

Parameters
  • X (array of items : array of items : float) – Training vectors, where n_samples is the number of samples and n_features is the number of features.

  • y (array of items : float) – Target values.

  • sample_weight (union type, optional) –

    Sample weights. If None, then samples are equally weighted.

    • array of items : float

    • or None

predict(X, **predict_params)

Make predictions.

Note: The predict method is not available until this operator is trained.

Once this method is available, it will have the following signature:

Parameters

X (array, optional of items : array of items : float) – The input samples.

Returns

result – Predicted targets.

Return type

array of items : float

transform(X, y=None)

Transform the data.

Note: The transform method is not available until this operator is trained.

Once this method is available, it will have the following signature:

Parameters

X (array, optional of items : array of items : float) – Training vectors, where n_samples is the number of samples and n_features is the number of features

Returns

result – Transformed array

  • items : array

    • items : union type

      • float

      • or array of items : float

Return type

array