pycaret.anomaly.create_model#
- pycaret.anomaly.create_model(model: str | Any, fraction: float = 0.05, verbose: bool = True, fit_kwargs: dict | None = None, experiment_custom_tags: Dict[str, Any] | None = None, **kwargs)[source]#
This function trains a given model from the model library. All available models can be accessed using the
modelsfunction.Example
>>> from pycaret.datasets import get_data >>> anomaly = get_data('anomaly') >>> from pycaret.anomaly import * >>> exp_name = setup(data = anomaly) >>> knn = create_model('knn')
- model: str or scikit-learn compatible object
ID of an model available in the model library or pass an untrained model object consistent with scikit-learn API. Estimators available in the model library (ID - Name):
‘abod’ - Angle-base Outlier Detection
‘cluster’ - Clustering-Based Local Outlier
‘cof’ - Connectivity-Based Outlier Factor
‘histogram’ - Histogram-based Outlier Detection
‘iforest’ - Isolation Forest
‘knn’ - k-Nearest Neighbors Detector
‘lof’ - Local Outlier Factor
‘svm’ - One-class SVM detector
‘pca’ - Principal Component Analysis
‘mcd’ - Minimum Covariance Determinant
‘sod’ - Subspace Outlier Detection
‘sos’ - Stochastic Outlier Selection
- fraction: float, default = 0.05
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 decision function.
- verbose: bool, default = True
Status update is not printed when verbose is set to False.
- experiment_custom_tags: dict, default = None
Dictionary of tag_name: String -> value: (String, but will be string-ified if not) passed to the mlflow.set_tags to add new custom tags for the experiment.
- fit_kwargs: dict, default = {} (empty dict)
Dictionary of arguments passed to the fit method of the model.
- **kwargs:
Additional keyword arguments to pass to the estimator.
- Returns:
Trained Model