Forecasting Methods

class pycast.methods.exponentialsmoothing.ExponentialSmoothing(smoothingFactor=0.1, valuesToForecast=1)[source]

Bases: pycast.methods.basemethod.BaseForecastingMethod

Implements an exponential smoothing algorithm.

Explanation:
http://www.youtube.com/watch?v=J4iODLa9hYw
__init__(smoothingFactor=0.1, valuesToForecast=1)[source]

Initializes the ExponentialSmoothing.

Parameters:
  • smoothingFactor (float) – Defines the alpha for the ExponentialSmoothing. Valid values are in (0.0, 1.0).
  • valuesToForecast (integer) – Number of values that should be forecasted.
Raise:

Raises a ValueError when smoothingFactor has an invalid value.

_get_parameter_intervals()[source]

Returns the intervals for the methods parameter.

Only parameters with defined intervals can be used for optimization!

Returns:Returns a dictionary containing the parameter intervals, using the parameter name as key, while the value hast the following format: [minValue, maxValue, minIntervalClosed, maxIntervalClosed]
  • minValue
    Minimal value for the parameter
  • maxValue
    Maximal value for the parameter
  • minIntervalClosed
    True, if minValue represents a valid value for the parameter. False otherwise.
  • maxIntervalClosed:
    True, if maxValue represents a valid value for the parameter. False otherwise.
Return type:dictionary
execute(timeSeries)[source]

Creates a new TimeSeries containing the smoothed and forcasted values.

Returns:TimeSeries object containing the smoothed TimeSeries, including the forecasted values.
Return type:TimeSeries
Note:The first normalized value is chosen as the starting point.
class pycast.methods.exponentialsmoothing.HoltMethod(smoothingFactor=0.1, trendSmoothingFactor=0.5, valuesToForecast=1)[source]

Bases: pycast.methods.basemethod.BaseForecastingMethod

Implements the Holt algorithm.

Explanation:
http://en.wikipedia.org/wiki/Exponential_smoothing#Double_exponential_smoothing
__init__(smoothingFactor=0.1, trendSmoothingFactor=0.5, valuesToForecast=1)[source]

Initializes the HoltMethod.

Parameters:
  • smoothingFactor (float) – Defines the alpha for the ExponentialSmoothing. Valid values are in (0.0, 1.0).
  • trendSmoothingFactor (float) – Defines the beta for the HoltMethod. Valid values are in (0.0, 1.0).
  • valuesToForecast (integer) – Defines the number of forecasted values that will be part of the result.
Raise:

Raises a ValueError when smoothingFactor or trendSmoothingFactor has an invalid value.

_get_parameter_intervals()[source]

Returns the intervals for the methods parameter.

Only parameters with defined intervals can be used for optimization!

Returns:Returns a dictionary containing the parameter intervals, using the parameter name as key, while the value hast the following format: [minValue, maxValue, minIntervalClosed, maxIntervalClosed]
  • minValue
    Minimal value for the parameter
  • maxValue
    Maximal value for the parameter
  • minIntervalClosed
    True, if minValue represents a valid value for the parameter. False otherwise.
  • maxIntervalClosed:
    True, if maxValue represents a valid value for the parameter. False otherwise.
Return type:dictionary
execute(timeSeries)[source]

Creates a new TimeSeries containing the smoothed values.

Returns:TimeSeries object containing the smoothed TimeSeries, including the forecasted values.
Return type:TimeSeries
Note:The first normalized value is chosen as the starting point.
class pycast.methods.exponentialsmoothing.HoltWintersMethod(smoothingFactor=0.1, trendSmoothingFactor=0.5, seasonSmoothingFactor=0.5, seasonLength=0, valuesToForecast=1)[source]

Bases: pycast.methods.basemethod.BaseForecastingMethod

Implements the Holt-Winters algorithm.

Explanation:
http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing
__init__(smoothingFactor=0.1, trendSmoothingFactor=0.5, seasonSmoothingFactor=0.5, seasonLength=0, valuesToForecast=1)[source]

Initializes the HoltWintersMethod.

Parameters:
  • smoothingFactor (float) – Defines the alpha for the Holt-Winters algorithm. Valid values are (0.0, 1.0).
  • trendSmoothingFactor (float) – Defines the beta for the Holt-Winters algorithm.. Valid values are (0.0, 1.0).
  • seasonSmoothingFactor (float) – Defines the gamma for the Holt-Winters algorithm. Valid values are (0.0, 1.0).
  • seasonLength (integer) – The expected length for the seasons. Please use a good estimate here!
  • valuesToForecast (integer) – Defines the number of forecasted values that will be part of the result.
_get_parameter_intervals()[source]

Returns the intervals for the methods parameter.

Only parameters with defined intervals can be used for optimization!

Returns:Returns a dictionary containing the parameter intervals, using the parameter name as key, while the value hast the following format: [minValue, maxValue, minIntervalClosed, maxIntervalClosed]
  • minValue
    Minimal value for the parameter
  • maxValue
    Maximal value for the parameter
  • minIntervalClosed
    True, if minValue represents a valid value for the parameter. False otherwise.
  • maxIntervalClosed:
    True, if maxValue represents a valid value for the parameter. False otherwise.
Return type:dictionary
computeA(j, timeSeries)[source]

Calculates A_j. Aj is the average value of x in the jth cycle of your data

Returns:A_j
Return type:numeric
execute(timeSeries)[source]

Creates a new TimeSeries containing the smoothed values.

Returns:TimeSeries object containing the exponentially smoothed TimeSeries, including the forecasted values.
Return type:TimeSeries
Note:Currently the first normalized value is simply chosen as the starting point.
initSeasonFactors(timeSeries)[source]

Computes the initial season smoothing factors.

Returns:Returns a list of season vectors of length “seasonLength”.
Return type:list
initialTrendSmoothingFactors(timeSeries)[source]

Calculate the initial Trend smoothing Factor b0.

Explanation:
http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing
Returns:Returns the initial trend smoothing factor b0

Previous topic

Smoothing Methods

Next topic

Custom Methods

This Page