IidSpikeDetector Class

This transform detects the spikes in a i.i.d. sequence using adaptive kernel density estimation.

Inheritance
nimbusml.internal.core.timeseries._iidspikedetector.IidSpikeDetector
IidSpikeDetector
nimbusml.base_transform.BaseTransform
IidSpikeDetector
sklearn.base.TransformerMixin
IidSpikeDetector

Constructor

IidSpikeDetector(confidence=99.0, side='TwoSided', pvalue_history_length=100, columns=None, **params)

Parameters

Name Description
columns

see Columns.

confidence

The confidence for spike detection in the range [0, 100].

side

The argument that determines whether to detect positive or negative anomalies, or both. Available options are {Positive, Negative, TwoSided}.

pvalue_history_length

The size of the sliding window for computing the p-value.

params

Additional arguments sent to compute engine.

Examples


   ###############################################################################
   # IidSpikeDetector
   import pandas as pd
   from nimbusml.timeseries import IidSpikeDetector

   X_train = pd.Series([5, 5, 5, 5, 5, 10, 5, 5, 5, 5, 5], name="ts")

   isd = IidSpikeDetector(confidence=95, pvalue_history_length=2.5) << {'result': 'ts'}

   isd.fit(X_train, verbose=1)
   data = isd.transform(X_train)

   print(data)

   #       ts  result.Alert  result.Raw Score  result.P-Value Score
   # 0    5.0           0.0               5.0          5.000000e-01
   # 1    5.0           0.0               5.0          5.000000e-01
   # 2    5.0           0.0               5.0          5.000000e-01
   # 3    5.0           0.0               5.0          5.000000e-01
   # 4    5.0           0.0               5.0          5.000000e-01
   # 5   10.0           1.0              10.0          1.000000e-08   <-- alert is on, predicted spike
   # 6    5.0           0.0               5.0          2.613750e-01
   # 7    5.0           0.0               5.0          2.613750e-01
   # 8    5.0           0.0               5.0          5.000000e-01
   # 9    5.0           0.0               5.0          5.000000e-01
   # 10   5.0           0.0               5.0          5.000000e-01

Remarks

IIDSpikeDetector assumes a sequence of data points that are independently sampled from one stationary distribution. Adaptive kernel density estimation is used to model the distribution. The p-value score indicates the likelihood of the current observation according to the estimated distribution. The lower its value, the more likely the current point is an outlier.

Methods

get_params

Get the parameters for this operator.

get_params

Get the parameters for this operator.

get_params(deep=False)

Parameters

Name Description
deep
Default value: False