One-Class SVM For Anomaly Detection

Amy @GrabNGoInfo
GrabNGoInfo
Published in
6 min readMar 25, 2022

--

Use unsupervised One-Class Support Vector Machine to detect outliers

Use unsupervised One-Class Support Vector Machine to detect outliers
Image Owned by GrabNGoInfo

One-Class Support Vector Machine (SVM) is an unsupervised model for anomaly or outlier detection. Unlike the regular supervised SVM, the one-class SVM does not have target labels for the model training process. Instead, it learns the boundary for the normal data points and identifies the data outside the border to be anomalies.

In this post, we will use Python’s sklearn library to implement one-class SVM. You will learn the following after reading the post:

  • How to train a one-class support vector machine (SVM) model
  • How to predict anomalies from a one-class SVM model
  • How to change the default threshold for anomaly prediction
  • How to visualize the prediction results

Resources for this post:

Let’s get started!

Step 1: Import Libraries

--

--