snowflake.ml.modeling.ensemble.BaggingRegressorΒΆ
- class snowflake.ml.modeling.ensemble.BaggingRegressor(*, estimator=None, n_estimators=10, max_samples=1.0, max_features=1.0, bootstrap=True, bootstrap_features=False, oob_score=False, warm_start=False, n_jobs=None, random_state=None, verbose=0, base_estimator='deprecated', input_cols: Optional[Union[str, Iterable[str]]] = None, output_cols: Optional[Union[str, Iterable[str]]] = None, label_cols: Optional[Union[str, Iterable[str]]] = None, drop_input_cols: Optional[bool] = False, sample_weight_col: Optional[str] = None)ΒΆ
Bases:
BaseTransformer
A Bagging regressor For more details on this class, see sklearn.ensemble.BaggingRegressor
- estimator: object, default=None
The base estimator to fit on random subsets of the dataset. If None, then the base estimator is a
DecisionTreeRegressor
.- n_estimators: int, default=10
The number of base estimators in the ensemble.
- max_samples: int or float, default=1.0
The number of samples to draw from X to train each base estimator (with replacement by default, see bootstrap for more details).
If int, then draw max_samples samples.
If float, then draw max_samples * X.shape[0] samples.
- max_features: int or float, default=1.0
The number of features to draw from X to train each base estimator ( without replacement by default, see bootstrap_features for more details).
If int, then draw max_features features.
If float, then draw max(1, int(max_features * n_features_in_)) features.
- bootstrap: bool, default=True
Whether samples are drawn with replacement. If False, sampling without replacement is performed.
- bootstrap_features: bool, default=False
Whether features are drawn with replacement.
- oob_score: bool, default=False
Whether to use out-of-bag samples to estimate the generalization error. Only available if bootstrap=True.
- warm_start: bool, default=False
When set to True, reuse the solution of the previous call to fit and add more estimators to the ensemble, otherwise, just fit a whole new ensemble. See the Glossary.
- n_jobs: int, default=None
The number of jobs to run in parallel for both
fit()
andpredict()
.None
means 1 unless in ajoblib.parallel_backend
context.-1
means using all processors. See Glossary for more details.- random_state: int, RandomState instance or None, default=None
Controls the random resampling of the original dataset (sample wise and feature wise). If the base estimator accepts a random_state attribute, a different seed is generated for each instance in the ensemble. Pass an int for reproducible output across multiple function calls. See Glossary.
- verbose: int, default=0
Controls the verbosity when fitting and predicting.
- base_estimator: object, default=βdeprecatedβ
Use estimator instead.
- input_cols: Optional[Union[str, List[str]]]
A string or list of strings representing column names that contain features. If this parameter is not specified, all columns in the input DataFrame except the columns specified by label_cols and sample-weight_col parameters are considered input columns.
- label_cols: Optional[Union[str, List[str]]]
A string or list of strings representing column names that contain labels. This is a required param for estimators, as there is no way to infer these columns. If this parameter is not specified, then object is fitted without labels(Like a transformer).
- output_cols: Optional[Union[str, List[str]]]
A string or list of strings representing column names that will store the output of predict and transform operations. The length of output_cols mus match the expected number of output columns from the specific estimator or transformer class used. If this parameter is not specified, output column names are derived by adding an OUTPUT_ prefix to the label column names. These inferred output column names work for estimatorβs predict() method, but output_cols must be set explicitly for transformers.
- sample_weight_col: Optional[str]
A string representing the column name containing the examplesβ weights. This argument is only required when working with weighted datasets.
- drop_input_cols: Optional[bool], default=False
If set, the response of predict(), transform() methods will not contain input columns.
Methods
fit
(dataset)Build a Bagging ensemble of estimators from the training set (X, y) For more details on this function, see sklearn.ensemble.BaggingRegressor.fit
predict
(dataset)Predict regression target for X For more details on this function, see sklearn.ensemble.BaggingRegressor.predict
score
(dataset)Return the coefficient of determination of the prediction For more details on this function, see sklearn.ensemble.BaggingRegressor.score
set_input_cols
(input_cols)Input columns setter.
to_sklearn
()Get sklearn.ensemble.BaggingRegressor object.
Attributes
model_signatures
Returns model signature of current class.