You are viewing documentation about an older version (1.0.9). View latest version

snowflake.ml.modeling.ensemble.BaggingClassifierΒΆ

class snowflake.ml.modeling.ensemble.BaggingClassifier(*, 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 classifier For more details on this class, see sklearn.ensemble.BaggingClassifier

estimator: object, default=None

The base estimator to fit on random subsets of the dataset. If None, then the base estimator is a DecisionTreeClassifier.

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() and predict(). None means 1 unless in a joblib.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

decision_function(dataset[, output_cols_prefix])

Average of the decision functions of the base classifiers For more details on this function, see sklearn.ensemble.BaggingClassifier.decision_function

fit(dataset)

Build a Bagging ensemble of estimators from the training set (X, y) For more details on this function, see sklearn.ensemble.BaggingClassifier.fit

predict(dataset)

Predict class for X For more details on this function, see sklearn.ensemble.BaggingClassifier.predict

predict_log_proba(dataset[, output_cols_prefix])

Predict class probabilities for X For more details on this function, see sklearn.ensemble.BaggingClassifier.predict_proba

predict_proba(dataset[, output_cols_prefix])

Predict class probabilities for X For more details on this function, see sklearn.ensemble.BaggingClassifier.predict_proba

score(dataset)

Return the mean accuracy on the given test data and labels For more details on this function, see sklearn.ensemble.BaggingClassifier.score

set_input_cols(input_cols)

Input columns setter.

to_sklearn()

Get sklearn.ensemble.BaggingClassifier object.

Attributes

model_signatures

Returns model signature of current class.