intermittent_forecast package

intermittent_forecast.adida

adida(ts, size=1, overlapping=False, method='auto', opt=True, alpha=None, beta=None, metric='mar', h=1, cycle=None)

Aggregate-disaggregate Intermittent Demand Approach. Input time series is aggregated into “buckets” to reduce or remove intermittency. One of the forecasting methods can then be applied to the aggregated series, followed by a seasonal or equal-weighted disaggregation.

Parameters
  • ts (array_like) – Input time series, 1-D list or array

  • size (int) – Size of aggregation window

  • overlapping (bool) – Aggregate with an overlapping or non-overlapping window

  • method ({'auto', 'cro', 'sba', 'sbj', 'tsb'}) – Forecasting method: Croston, Syntetos-Boylan Approximation, Shale-Boylan-Johnston, Teunter-Syntetos-Babai. If ‘auto’, either Croston’s method or SBA will be chosen based on CV^2 and mean demand interval.

  • alpha (float) – Demand smoothing factor, 0 < alpha < 1

  • beta (float) – Interval smoothing factor, 0 < beta < 1

  • opt (boolean) – Optimise smoothing factors. If a value for alpha is passed, then optimisation will not occur.

  • metric ({'mar', 'mae', 'mse', 'msr', 'pis'}) – Error metric to be used for optimisation of smoothing factors

  • h (int) – Forecasting horizon, number of periods to forecast

  • cycle (int, optional) – For a seasonal disaggregation, enter the number of periods in the seasonal cycle of the input time series. If not defined, the disaggregation will be equal weighted.

Returns

forecast – 1-D array of forecasted values

Return type

ndarray

intermittent_forecast.croston

croston(ts, method='cro', alpha=None, beta=None, opt=True, metric='mar')

Perform smoothing on an intermittent time series, ts, and return a forecast array

Parameters
  • ts ((N,) array_like) – 1-D input time series

  • method ({'cro', 'sba', 'sbj', 'tsb', 'auto'}) – Forecasting method: Croston, Syntetos-Boylan Approximation, Shale-Boylan-Johnston, Teunter-Syntetos-Babai. If ‘auto’, either Croston’s method or SBA will be chosen based on CV^2 and mean demand interval.

  • alpha (float) – Demand smoothing factor, 0 < alpha < 1

  • beta (float) – Interval smoothing factor, 0 < beta < 1

  • opt (boolean) – Optimise smoothing factors

  • metric ({'mar', 'mae', 'mse', 'msr', 'pis'}) – Error metric to be used for optimisation of smoothing factors

Returns

forecast – 1-D array of forecasted values

Return type

(N+1,) ndarray

intermittent_forecast.imapa

imapa(ts, sizes=[1], combine='mean', overlapping=False, method='auto', opt=True, alpha=None, beta=None, metric='mar', h=1, cycle=None)

Intermittent Multiple Aggregation Prediction Algorithm. For each aggregation level, ADIDA will be performed. The resulting forecasts will then be combined.

Parameters
  • ts (array_like) – Input time series, 1-D list or array

  • sizes (list) – Aggregation sizes to use, list of integers.

  • combine ({'mean', 'median'}) – Combine the forecasts using either the mean or median

  • overlapping (bool) – Aggregate with an overlapping or non-overlapping window

  • method ({'auto', 'cro', 'sba', 'sbj', 'tsb'}) – Forecasting method: Croston, Syntetos-Boylan Approximation, Shale-Boylan-Johnston, Teunter-Syntetos-Babai. If ‘auto’, either Croston’s method or SBA will be chosen based on CV^2 and mean demand interval.

  • alpha (float) – Demand smoothing factor, 0 < alpha < 1

  • beta (float) – Interval smoothing factor, 0 < beta < 1

  • opt (boolean) – Optimise smoothing factors. If a value for alpha is passed, then optimisation will not occur.

  • metric ({'mar', 'mae', 'mse', 'msr', 'pis'}) – Error metric to be used for optimisation of smoothing factors

  • h (int) – Forecasting horizon, number of periods to forecast

  • cycle (int, optional) – For a seasonal disaggregation, enter the number of periods in the seasonal cycle of the input time series. If not If not defined, the disaggregation will be equal weighted.

Returns

forecast – 1-D array of forecasted values

Return type

ndarray