scaler
¶
Classes:
Name | Description |
---|---|
AnomalyMeanScaler |
Wrapper around an anomaly detector that scales the model's output |
AnomalyMinMaxScaler |
Wrapper around an anomaly detector that scales the model's output to |
AnomalyScaler |
Wrapper around an anomaly detector that scales the output of the model |
AnomalyStandardScaler |
Wrapper around an anomaly detector that standardizes the model's output |
AnomalyMeanScaler
¶
Bases: AnomalyScaler
Wrapper around an anomaly detector that scales the model's output by the incremental mean of previous scores.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
anomaly_detector
|
AnomalyDetector
|
The anomaly detector to wrap. |
required |
metric_type
|
The type of metric to use. |
required | |
rolling
|
bool
|
Choose whether the metrics are rolling metrics or not. |
True
|
window_size
|
The window size used for mean computation if rolling==True. |
250
|
Methods:
Name | Description |
---|---|
learn_one |
Update the scaler and the underlying anomaly scaler. |
score_many |
Return scaled anomaly scores based on raw score provided by |
score_one |
Return a scaled anomaly score based on raw score provided by the |
Source code in deep_river/anomaly/scaler.py
learn_one
¶
Update the scaler and the underlying anomaly scaler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
AnomalyScaler
|
The model itself. |
Source code in deep_river/anomaly/scaler.py
score_many
abstractmethod
¶
Return scaled anomaly scores based on raw score provided by the wrapped anomaly detector.
A high score is indicative of an anomaly. A low score corresponds to a normal observation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
Scaled anomaly scores. Larger values indicate more anomalous examples.
|
|
Source code in deep_river/anomaly/scaler.py
score_one
¶
Return a scaled anomaly score based on raw score provided by the wrapped anomaly detector. Larger values indicate more anomalous examples.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
An scaled anomaly score. Larger values indicate more
|
|
anomalous examples.
|
|
Source code in deep_river/anomaly/scaler.py
AnomalyMinMaxScaler
¶
AnomalyMinMaxScaler(
anomaly_detector: AnomalyDetector,
rolling: bool = True,
window_size: int = 250,
)
Bases: AnomalyScaler
Wrapper around an anomaly detector that scales the model's output to \([0, 1]\) using rolling min and max metrics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
anomaly_detector
|
AnomalyDetector
|
The anomaly detector to wrap. |
required |
rolling
|
bool
|
Choose whether the metrics are rolling metrics or not. |
True
|
window_size
|
int
|
The window size used for the metrics if rolling==True |
250
|
Methods:
Name | Description |
---|---|
learn_one |
Update the scaler and the underlying anomaly scaler. |
score_many |
Return scaled anomaly scores based on raw score provided by |
score_one |
Return a scaled anomaly score based on raw score provided by the |
Source code in deep_river/anomaly/scaler.py
learn_one
¶
Update the scaler and the underlying anomaly scaler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
AnomalyScaler
|
The model itself. |
Source code in deep_river/anomaly/scaler.py
score_many
abstractmethod
¶
Return scaled anomaly scores based on raw score provided by the wrapped anomaly detector.
A high score is indicative of an anomaly. A low score corresponds to a normal observation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
Scaled anomaly scores. Larger values indicate more anomalous examples.
|
|
Source code in deep_river/anomaly/scaler.py
score_one
¶
Return a scaled anomaly score based on raw score provided by the wrapped anomaly detector. Larger values indicate more anomalous examples.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
An scaled anomaly score. Larger values indicate more
|
|
anomalous examples.
|
|
Source code in deep_river/anomaly/scaler.py
AnomalyScaler
¶
Bases: Wrapper
, AnomalyDetector
Wrapper around an anomaly detector that scales the output of the model to account for drift in the wrapped model's anomaly scores.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
anomaly_detector
|
AnomalyDetector
|
Anomaly detector to be wrapped. |
required |
Methods:
Name | Description |
---|---|
learn_one |
Update the scaler and the underlying anomaly scaler. |
score_many |
Return scaled anomaly scores based on raw score provided by |
score_one |
Return a scaled anomaly score based on raw score provided by |
Source code in deep_river/anomaly/scaler.py
learn_one
¶
Update the scaler and the underlying anomaly scaler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
AnomalyScaler
|
The model itself. |
Source code in deep_river/anomaly/scaler.py
score_many
abstractmethod
¶
Return scaled anomaly scores based on raw score provided by the wrapped anomaly detector.
A high score is indicative of an anomaly. A low score corresponds to a normal observation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
Scaled anomaly scores. Larger values indicate more anomalous examples.
|
|
Source code in deep_river/anomaly/scaler.py
score_one
abstractmethod
¶
Return a scaled anomaly score based on raw score provided by the wrapped anomaly detector.
A high score is indicative of an anomaly. A low score corresponds to a normal observation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
An scaled anomaly score. Larger values indicate
|
|
more anomalous examples.
|
|
Source code in deep_river/anomaly/scaler.py
AnomalyStandardScaler
¶
AnomalyStandardScaler(
anomaly_detector: AnomalyDetector,
with_std: bool = True,
rolling: bool = True,
window_size: int = 250,
)
Bases: AnomalyScaler
Wrapper around an anomaly detector that standardizes the model's output using incremental mean and variance metrics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
anomaly_detector
|
AnomalyDetector
|
The anomaly detector to wrap. |
required |
with_std
|
bool
|
Whether to use standard deviation for scaling. |
True
|
rolling
|
bool
|
Choose whether the metrics are rolling metrics or not. |
True
|
window_size
|
int
|
The window size used for the metrics if rolling==True. |
250
|
Methods:
Name | Description |
---|---|
learn_one |
Update the scaler and the underlying anomaly scaler. |
score_many |
Return scaled anomaly scores based on raw score provided by |
score_one |
Return a scaled anomaly score based on raw score provided by the |
Source code in deep_river/anomaly/scaler.py
learn_one
¶
Update the scaler and the underlying anomaly scaler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
AnomalyScaler
|
The model itself. |
Source code in deep_river/anomaly/scaler.py
score_many
abstractmethod
¶
Return scaled anomaly scores based on raw score provided by the wrapped anomaly detector.
A high score is indicative of an anomaly. A low score corresponds to a normal observation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
Scaled anomaly scores. Larger values indicate more anomalous examples.
|
|
Source code in deep_river/anomaly/scaler.py
score_one
¶
Return a scaled anomaly score based on raw score provided by the wrapped anomaly detector. Larger values indicate more anomalous examples.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Depends on whether the underlying anomaly detector is supervised or not. |
()
|
Returns:
Type | Description |
---|---|
An scaled anomaly score. Larger values indicate more
|
|
anomalous examples.
|
|