pysad.models.ExactStorm¶
- class pysad.models.ExactStorm(window_size=10000, max_radius=0.1)[source]¶
The Exact-STORM method [BAF07]. This method assigns anomaly score that is the mean of distances to the instances in window of length window_size with distnaces less than max_radius. Note that the decision making in [BAF07] is not implemented.
- Parameters:
window_size – int (Default=10000) The number of instances in the window to score.
max_radius – float (Default=0.1) Maximum radius for the near instance selection.
Methods
__init__
([window_size, max_radius])fit
(X[, y])Fits the model to all instances in order.
fit_partial
(X[, y])Fits the model to next instance.
fit_score
(X[, y])This helper method applies fit_score_partial to all instances in order.
fit_score_partial
(X[, y])Applies fit_partial and score_partial to the next instance, respectively.
score
(X)Scores all instaces via score_partial iteratively.
Scores the anomalousness of the next instance.
- fit(X, y=None)¶
Fits the model to all instances in order.
- fit_partial(X, y=None)[source]¶
Fits the model to next instance. Simply, adds the instance to the window.
- fit_score(X, y=None)¶
This helper method applies fit_score_partial to all instances in order.
- Parameters:
X (np.float64 array of shape (num_instances, num_features)) – The instances in order to fit.
y (np.int32 array of shape (num_instances, )) – The labels of the instances in order to fit (Optional for unsupervised models, default=None).
- Returns:
The anomalousness scores of the instances in order.
- Return type:
np.float64 array of shape (num_instances,)
- fit_score_partial(X, y=None)¶
Applies fit_partial and score_partial to the next instance, respectively.
- score(X)¶
Scores all instaces via score_partial iteratively.
- Parameters:
X (np.float64 array of shape (num_instances, num_features)) – The instances in order to score.
- Returns:
The anomalousness scores of the instances in order.
- Return type:
np.float64 array of shape (num_instances,)
- score_partial(X)[source]¶
Scores the anomalousness of the next instance.
- Parameters:
X (np.float64 array of shape (num_features,)) – The instance to score. Higher scores represent more anomalous instances whereas lower scores correspond to more normal instances.
- Returns:
The anomalousness score of the input instance.
- Return type: