Class: TeaLeaves::ExponentialSmoothingForecast::MultiplicativeSeasonalityStrategy

Inherits:
SeasonalityStrategy
  • Object
show all
Defined in:
lib/tealeaves/exponential_smoothing_forecast.rb

Instance Attribute Summary

Attributes inherited from SeasonalityStrategy

#start_index

Instance Method Summary collapse

Methods inherited from SeasonalityStrategy

#initialize, #new_values

Constructor Details

This class inherits a constructor from TeaLeaves::ExponentialSmoothingForecast::SeasonalityStrategy

Instance Method Details

#apply(forecast, parameters, n) ⇒ Object



44
45
46
47
# File 'lib/tealeaves/exponential_smoothing_forecast.rb', line 44

def apply(forecast, parameters, n)
  index = (n - 1) % parameters[:seasonality].size
  forecast * parameters[:seasonality][index]
end

#p(value, params) ⇒ Object



36
37
38
# File 'lib/tealeaves/exponential_smoothing_forecast.rb', line 36

def p(value, params)
  value / params[:seasonality].first
end

#t(value, new_level) ⇒ Object



40
41
42
# File 'lib/tealeaves/exponential_smoothing_forecast.rb', line 40

def t(value, new_level)
  value / new_level
end