snowflake.ml.modeling.ensemble.IsolationForest¶
- class snowflake.ml.modeling.ensemble.IsolationForest(*, n_estimators=100, max_samples='auto', contamination='auto', max_features=1.0, bootstrap=False, n_jobs=None, random_state=None, verbose=0, warm_start=False, 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
Isolation Forest Algorithm For more details on this class, see sklearn.ensemble.IsolationForest
- n_estimators: int, default=100
The number of base estimators in the ensemble.
- max_samples: “auto”, int or float, default=”auto”
- The number of samples to draw from X to train each base estimator.
If int, then draw max_samples samples.
If float, then draw max_samples * X.shape[0] samples.
If “auto”, then max_samples=min(256, n_samples).
If max_samples is larger than the number of samples provided, all samples will be used for all trees (no sampling).
- contamination: ‘auto’ or float, default=’auto’
The amount of contamination of the data set, i.e. the proportion of outliers in the data set. Used when fitting to define the threshold on the scores of the samples.
If ‘auto’, the threshold is determined as in the original paper.
If float, the contamination should be in the range (0, 0.5].
- max_features: int or float, default=1.0
The number of features to draw from X to train each base estimator.
If int, then draw max_features features.
If float, then draw max(1, int(max_features * n_features_in_)) features.
Note: using a float number less than 1.0 or integer less than number of features will enable feature subsampling and leads to a longer runtime.
- bootstrap: bool, default=False
If True, individual trees are fit on random subsets of the training data sampled with replacement. If False, sampling without replacement is performed.
- 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 pseudo-randomness of the selection of the feature and split values for each branching step and each tree in the forest.
Pass an int for reproducible results across multiple function calls. See Glossary.
- verbose: int, default=0
Controls the verbosity of the tree building process.
- 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 forest. See the Glossary.- 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 anomaly score of X of the base classifiers For more details on this function, see sklearn.ensemble.IsolationForest.decision_function
fit
(dataset)Fit estimator For more details on this function, see sklearn.ensemble.IsolationForest.fit
predict
(dataset)Predict if a particular sample is an outlier or not For more details on this function, see sklearn.ensemble.IsolationForest.predict
score
(dataset)Method not supported for this class.
set_input_cols
(input_cols)Input columns setter.
to_sklearn
()Get sklearn.ensemble.IsolationForest object.
Attributes
model_signatures
Returns model signature of current class.