ADICVTransformer
Transformer categorizing series into ADI-CV2 classes after Syntetos/Boylan.
Transforms a time series into a category label, which is one of: "smooth", "erratic", "intermittent", or "lumpy".
The labels are based on the Average Demand Interval (ADI) and the Coefficient of Variation squared (CV^2) of the time series, using simple thresholding. Optionally, the transformer can return the ADI and CV^2 values as well.
Let \(x_t\) be the value of the time series at times \(t = 1, 2, \dots, T\), and let \(N\) be the number of non-zero values in the time series, i.e., \(N = \text{card}\{t: x_t \neq 0\}\).
The ADI and CV^2 are calculated as follows:
1. Average Demand Interval (ADI): The average number of periods between periods with non-zero demand, mathematically defined as:
2. Coefficient of Variation squared (CV^2): CV is calculated on non-zero values in the time series. Mathematical definition is:
3. Class: Classification of time series on basis of ADI threshold and CV^2 threshold.
For thresholds ADI_threshold and CV2_threshold, the classes are:
Smooth: If
ADI <= adi_thresholdandCV2 <= cv2_thresholdErratic: If
ADI <= adi_thresholdandCV2 > cv2_thresholdIntermittent: If
ADI > adi_thresholdandcv2 <= cv2_thresholdLumpy: if
ADI > adi_thresholdandCV2 > cv2_threshold
Default values for the thresholds are taken from the paper by Syntetos/Boylan [1]. namely, adi_threshold = 1.32 and cv2_threshold = 0.49. They can also be adjusted by passing them as parameters to the transformer.
Quickstart
from sktime.transformations.adi_cv import ADICVTransformer
estimator = ADICVTransformer(features=None, adi_threshold=1.32, cv_threshold=0.49, adi_trim_handling='pool')Parameters(4)
- adi_thresholdfloat (default = 1.32)
- Specifies the ADI threshold utilized for classifying the time series
- cv2_thresholdfloat (default = 0.49)
- Specifies the CV2 threshold utilized for classifying the time series
- featureslist[str] | None (default = [‘adi’, ‘cv2’, ‘class’])
- Specifies all of the feature values to be calculated
- adi_trim_handling: string (default = pool)
Specifies the method for reconciling leading/trailing zeros in the series. Allowable values are (‘pool’, ‘trim’, and ‘ignore’), corresponding to the following treatment of leading/trailing zeros: pool => L / N trim => (Last N - First N) / N ignore => L / (N - 1)
where L is the set of All Observations, and N is the set of Non-Zero observations
Examples
>>> from sktime.transformations.adi_cv import ADICVTransformer
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> transformer = ADICVTransformer ()
>>> y_hat = transformer. fit_transform (y)References
- [1]: John E. Boylan, Aris Syntetos: The Accuracy of Intermittent Demand Estimates. International Journal of Forecasting, 1 Apr. 2005