pycaret.anomaly.save_model#
- pycaret.anomaly.save_model(model, model_name: str, model_only: bool = False, verbose: bool = True, **kwargs)[source]#
This function saves the transformation pipeline and trained model object into the current working directory as a pickle file for later use.
Example
>>> from pycaret.datasets import get_data >>> anomaly = get_data('anomaly') >>> from pycaret.anomaly import * >>> exp_name = setup(data = anomaly) >>> knn = create_model('knn') >>> save_model(knn, 'saved_knn_model')
- model: scikit-learn compatible object
Trained model object
- model_name: str
Name of the model.
- model_only: bool, default = False
When set to True, only trained model object is saved instead of the entire pipeline.
- verbose: bool, default = True
Success message is not printed when verbose is set to False.
- **kwargs:
Additional keyword arguments to pass to joblib.dump().
- Returns:
Tuple of the model object and the filename.