Anomaly Detection Using PyCaret!!!

Getting Started with Anomaly Detection!!

If you are not familiar with PyCaret. I suggest you to first go through the below link before moving on from here.

Complete Guide to PyCaret.

Also, Check out our Article on:

Reading Data

from pycaret.datasets import get_dataget_data('index')

Scrolling down we can find datasets available for the Classification Modelling.

import pycaretfrom pycaret.anomaly import *data = get_data('anomaly')

We will use the anomaly data

Setting up the PyCaret environment

ano = setup(data = data)

After this press enter and you will get results as shown below.

Creating Models

create_model('Model_id')

Model ID for Anomaly Models.

+-------------+-----------------------------------+
| ID | Name |
+-------------+-----------------------------------+
| ‘abod’ | Angle-base Outlier Detection |
| ‘iforest’ | Isolation Forest |
| ‘cluster’ | Clustering-Based Local Outlier |
| ‘cof’ | Connectivity-Based Outlier Factor |
| ‘histogram’ | Histogram-based Outlier Detection |
| ‘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 |
+-------------+-----------------------------------+

Plot a Model

plot_model(model)

Predict Model

prediction = predict_model(model,data = data)

Save Models

Also, Check out our Article on:

Visit us on https://www.insaid.co/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
INSAID

INSAID

523 Followers

One of India’s leading institutions providing world-class Data Science & AI programs for working professionals with a mission to groom Data leaders of tomorrow!