RollingStandardDeviationDetector
RollingStandardDeviationDetector(window_size=10, max_std=np.inf, center=True)Detect large variations.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| window_size | int | Number of data points to evaluate over. | 10 |
| max_std | float | Maximum standard deviation to accept as normal. | np.inf |
| center | bool | If True, set the labels at the center of the window. | True |
Methods
| Name | Description |
|---|---|
| detect | Detect anomalies |
| fit | Set detector parameters based on data. |
| save | Save a detector for later use. |
| validate | Check that input data is in correct format and possibly adjust. |
detect
RollingStandardDeviationDetector.detect(data)Detect anomalies
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data | Union[pd.Series, pd.DataFrame] | Time series data with possible anomalies | required |
Returns
| Name | Type | Description |
|---|---|---|
| pd.Series or pd.DataFrame | Time series with bools, True == anomaly. |
fit
RollingStandardDeviationDetector.fit(data)Set detector parameters based on data.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data | Union[pd.Series, pd.DataFrame] | Normal (non-anomalous) time series data for training. If DataFrame, must contain exactly one column | required |
Returns
| Name | Type | Description |
|---|---|---|
| Self |
save
RollingStandardDeviationDetector.save(path)Save a detector for later use.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| path | str or Path | File path to save the detector to. | required |
validate
RollingStandardDeviationDetector.validate(data)Check that input data is in correct format and possibly adjust.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| data | pd.Series or pd.DataFrame | Input data to validate. | required |
Returns
| Name | Type | Description |
|---|---|---|
| pd.DataFrame | Validated data. |
Raises
| Name | Type | Description |
|---|---|---|
| WrongInputDataTypeError | If data is not a pd.Series or pd.DataFrame. |