Class: TeaLeaves::ExponentialSmoothingForecast::AdditiveSeasonalityStrategy

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



29
30
31
32
# File 'lib/tealeaves/exponential_smoothing_forecast.rb', line 29

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

#p(value, params) ⇒ Object



21
22
23
# File 'lib/tealeaves/exponential_smoothing_forecast.rb', line 21

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

#t(value, new_level) ⇒ Object



25
26
27
# File 'lib/tealeaves/exponential_smoothing_forecast.rb', line 25

def t(value, new_level)
  value - new_level
end