What is One-Class SVM?
One-class Support Vector Machines (SVM) are a type of machine learning algorithm designed to identify anomalies or outliers within data. Unlike traditional binary classification methods that require both positive and negative examples, one-class SVM learns from only the normal class of data points.
The goal is to define a boundary around the normal data distribution such that any point outside this boundary can be considered an anomaly.
How Does One-Class SVM Work?
One-class SVM uses a support vector machine framework but with a different objective. It seeks to find a hyperplane in the feature space that maximizes the margin around the data points, effectively creating a boundary that encloses the majority of the normal data.
The RBF (Radial Basis Function) kernel is commonly used because it can handle non-linearly separable data by mapping the input data into a higher-dimensional space where a linear separation might be possible.
Parameters and Their Impact
Two key parameters in one-class SVM are gamma (kernel width) and nu (expected outlier fraction). Gamma controls how far the influence of a single training example reaches, with low values meaning 'far' and high values meaning 'close'.
Nu is an upper bound on the fraction of training errors and a lower bound of the fraction of support vectors. Adjusting these parameters can significantly affect the shape and position of the anomaly detection boundary.
Real-World Applications
One-class SVM has numerous applications, such as fraud detection in financial transactions, network intrusion detection, and fault detection in industrial processes.
By learning from normal data patterns, one-class SVM can effectively flag unusual events or anomalies that deviate significantly from the learned pattern.
Frequently asked questions
What is the role of gamma in one-class SVM?
Gamma controls the width of the RBF kernel and influences how much the model considers distant data points. A smaller gamma value means a wider influence, while a larger value focuses more on nearby points.
How does nu affect the boundary created by one-class SVM?
Nu sets an upper limit on the number of outliers and a lower limit on the number of support vectors. A higher nu value allows for more flexibility in the boundary, potentially capturing more data points within it.
Can one-class SVM be used for binary classification?
No, one-class SVM is specifically designed for anomaly detection and cannot directly perform binary classification tasks that require both positive and negative examples.
What are the limitations of using one-class SVM?
One-class SVM can be sensitive to the choice of parameters and may not generalize well if the training data is not representative of the entire dataset. Additionally, it assumes a single class of normal data, which might not always be the case in real-world scenarios.
Try it live
Everything above runs in your browser — open One-Class SVM Anomaly Boundary and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open One-Class SVM Anomaly Boundary simulation