Skip to content

ADICVTransformer

ADICVTransformer

class ADICVTransformer(features=None, adi_threshold=1.32, cv_threshold=0.49, adi_trim_handling='pool')[source]

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:

\[ADI = \frac{T}{N}\]

2. Coefficient of Variation squared (CV^2): CV is calculated on non-zero values in the time series. Mathematical definition is:

\[CV2 = \frac{1}{N}\sum_{t=1}^{T} x_t^2 - \left(\frac{1}{N}\sum_{t=1}^{T} x_t\right)^2\]

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:

  1. Smooth: If ADI <= adi_threshold and CV2 <= cv2_threshold

  2. Erratic: If ADI <= adi_threshold and CV2 > cv2_threshold

  3. Intermittent: If ADI > adi_threshold and cv2 <= cv2_threshold

  4. Lumpy: if ADI > adi_threshold and CV2 > 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.

Parameters:
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

Attributes:
is_fitted

Whether fit has been called.

References

[1]: John E. Boylan, Aris Syntetos: The Accuracy of Intermittent Demand Estimates. International Journal of Forecasting, 1 Apr. 2005

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)

Methods

check_is_fitted([method_name])

Check if the estimator has been fitted.

clone()

Obtain a clone of the object with same hyper-parameters and config.

clone_tags(estimator[, tag_names])

Clone tags from another object as dynamic override.

create_test_instance([parameter_set])

Construct an instance of the class, using first test parameter set.

create_test_instances_and_names([parameter_set])

Create list of all test instances and a list of names for them.

fit(X[, y])

Fit transformer to X, optionally to y.

fit_transform(X[, y])

Fit to data, then transform it.

get_class_tag(tag_name[, tag_value_default])

Get class tag value from class, with tag level inheritance from parents.

get_class_tags()

Get class tags from class, with tag level inheritance from parent classes.

get_config()

Get config flags for self.

get_fitted_params([deep])

Get fitted parameters.

get_param_defaults()

Get object's parameter defaults.

get_param_names([sort])

Get object's parameter names.

get_params([deep])

Get a dict of parameters values for this object.

get_tag(tag_name[, tag_value_default, ...])

Get tag value from instance, with tag level inheritance and overrides.

get_tags()

Get tags from instance, with tag level inheritance and overrides.

get_test_params([parameter_set])

Return testing parameter settings for the estimator.

inverse_transform(X[, y])

Inverse transform X and return an inverse transformed version.

is_composite()

Check if the object is composed of other BaseObjects.

load_from_path(serial)

Load object from file location.

load_from_serial(serial)

Load object from serialized memory container.

reset()

Reset the object to a clean post-init state.

save([path, serialization_format])

Save serialized self to bytes-like object or to (.zip) file.

set_config(**config_dict)

Set config flags to given values.

set_params(**params)

Set the parameters of this object.

set_random_state([random_state, deep, ...])

Set random_state pseudo-random seed parameters for self.

set_tags(**tag_dict)

Set instance level tag overrides to given values.

transform(X[, y])

Transform X and return a transformed version.

update(X[, y, update_params])

Update transformer with X, optionally y.