ConstantGradientDetector

ConstantGradientDetector(window_size=3)

Detect constant gradients.

Typically caused by linear interpolation over a long interval.

Parameters

Name Type Description Default
window_size int Minimum window size to consider as anomaly. 3

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

ConstantGradientDetector.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

ConstantGradientDetector.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

ConstantGradientDetector.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

ConstantGradientDetector.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.