Logarithm::SVM
Inherits Logarithm::AbstractModel < Reference < Object
Support Vector Machine for anomaly detection.
This class implements a simple linear SVM for unsupervised anomaly detection. It uses the One-Class SVM approach where training data is considered normal, and anomalies are detected based on distance to the decision boundary.
The SVM finds a hyperplane that maximizes the margin between the origin and the support vectors. During inference, the distance to this hyperplane indicates anomaly likelihood (negative distances are anomalies).
Constructors
Instance methods
Loads a trained model from a file.
Parameters:
- path: File path to load the model from
Deserializes the model from a string.
Parameters:
- data: String representation of the model
Performs inference on a single input vector.
Given an input vector, the model attempts to reconstruct it based on learned patterns. The reconstruction quality indicates how "normal" the input appears to the model.
Parameters:
- input: Input vector to reconstruct
Returns: Reconstructed vector (same dimensions as input)
The reconstruction error (input - output) is used for anomaly scoring.
Saves the trained model to a file.
Parameters:
- path: File path to save the model to
Serializes the model to a string for storage/encryption.
Returns: String representation of the trained model
Trains the model on vectorized log data.
This method implements the learning algorithm that allows the model to learn patterns in normal log data. The training process optimizes the model's parameters to minimize reconstruction error for normal data.
Parameters:
- data: Array of training vectors (from vectorizer)
- epochs: Number of training iterations over the dataset
Training may take significant time depending on data size and epochs.