pycaret.anomaly.predict_model#

pycaret.anomaly.predict_model(model, data: DataFrame) DataFrame[source]#

This function generates anomaly labels on using a trained model.

Example

>>> from pycaret.datasets import get_data
>>> anomaly = get_data('anomaly')
>>> from pycaret.anomaly import *
>>> exp_name = setup(data = anomaly)
>>> knn = create_model('knn')
>>> knn_predictions = predict_model(model = knn, data = unseen_data)
model: scikit-learn compatible object

Trained Model Object.

datapandas.DataFrame

Shape (n_samples, n_features) where n_samples is the number of samples and n_features is the number of features.

Returns:

pandas.DataFrame

Warning

  • The behavior of the predict_model is changed in version 2.1 without backward compatibility. As such, the pipelines trained using the version (<= 2.0), may not work for inference with version >= 2.1. You can either retrain your models with a newer version or downgrade the version for inference.