spark-timeseries icon indicating copy to clipboard operation
spark-timeseries copied to clipboard

Triple Exponential Smoothing Model

Open cjnolet opened this issue 9 years ago • 13 comments

It's nice there's an exponentially weighted moving average. I think that could lend itself to more complex moving averages, like HoltWinters models, for instance, which include a weight for the season.

cjnolet avatar Jul 15 '15 20:07 cjnolet

https://www.otexts.org/fpp/7/5

cjnolet avatar Jul 15 '15 20:07 cjnolet

I know @josepablocam was working on a prototype of this

sryza avatar Jul 15 '15 21:07 sryza

I was thinking this could probably be achieved as part of the ARIMA implementation but I figured it wouldn't hurt to separate the requirement anyways.

On Wed, Jul 15, 2015 at 5:28 PM, Sandy Ryza [email protected] wrote:

I know @josepablocam https://github.com/josepablocam was working on a prototype of this

— Reply to this email directly or view it on GitHub https://github.com/cloudera/spark-timeseries/issues/35#issuecomment-121755784 .

cjnolet avatar Jul 15 '15 21:07 cjnolet

@sryza and @cjnolet I had actually been working on the double exponential smoothing (i.e. trend and level, but no seasonality). I planned on doing triple after, but got sidetracked. I think double exponential is pretty much done, so I'll clean up tomorrow and submit a PR. I can take a stab at the triple after that.

I'm working on an ARIMA implementation, but non-seasonal, so it couldn't currently be used to create a model equivalent to holt winters.

josepablocam avatar Jul 16 '15 00:07 josepablocam

@cjnolet I started on a holt winters implementation. I hope to get to work on it tomorrow. Implementing the additive variant for now. The one thing I did notice though, and perhaps you can explain to me, as I can't quite seem to get it.

I was looking at the Hyndman text at https://www.otexts.org/fpp/7/5 and, unless I'm reading the formulas wrong, I don't see how they're getting the trend values (b) stated there (and that result from the R commands).

> library(fpp)
> aust <- window(austourists,start=2005)
> fit1 <- hw(aust,seasonal="additive")
> fit1$model$par
       alpha         beta        gamma            l            b           s0 
 0.025421909  0.023019310  0.000100015 33.814439670  0.645421150  1.384362895 
          s1           s2 
-2.552880365 -9.485076369 
> fit1$model$states[1:4,]
            l         b        s1        s2        s3        s4
[1,] 33.81444 0.6454211  1.384363 -2.552880 -9.485076 10.653594
[2,] 34.37378 0.5674778 10.653255  1.384363 -2.552880 -9.485076
[3,] 34.90531 0.5349209 -9.485218 10.653255  1.384363 -2.552880
[4,] 35.42601 0.5220475 -2.552936 -9.485218 10.653255  1.384363

Let's take period 2 for example. According to the formulas $latex b_t = \beta * (l_t - l_{t-1}) + (1 - \beta)*b_{t-1}$. So in this case that would be

> 0.023019310 * (34.37378 - 33.81444) + (1 - 0.023019310) * 0.6454211
[1] 0.6434396

Which doesn't seem to agree at all with the value reported in the states for b at period 2. Anything obvious I'm missing?

josepablocam avatar Jul 17 '15 08:07 josepablocam

Is Triple Exponential smoothing implementation complete and in place?

meerav avatar Jan 19 '16 22:01 meerav

Hi @meerav, triple exponential smoothing is not yet complete.

sryza avatar Jan 21 '16 07:01 sryza

@josepablocam Could you send the pull request, so that probably we can test and collaborate on it? I am also interested in the Holt-Winter implementation.

jyssky avatar Feb 09 '16 17:02 jyssky

@flyjy I haven't taken a look at this in a while, so not sure how it stands for even a starting off point. I'll aim to look into it by end of the week, and if it is at a point where not scrapping and starting anew make sense, then I'll put in the PR.

josepablocam avatar Feb 09 '16 17:02 josepablocam

@rchanda Do you have your Java implementation on an open repository somewhere. I am looking for a scala (or java) implementation of the algorithm. I can help test it and compare it with the results of the R version (forecast library).

sangv avatar Mar 11 '16 15:03 sangv

Can anyone please share java code for single and double exponential smoothing with maven dependencies so used in pom.xml. Please, help me I started work with spark from 2 months so not as much good in code. I already have scala file but if possible in java so I am comfortable with that only.

devanshi7 avatar Nov 09 '16 08:11 devanshi7

Is triple exponential smoothing possible in spark? Please inform if possible and share code of triple exponential smoothing in spark using java.

devanshi7 avatar Dec 02 '16 13:12 devanshi7

Hi. Is there a finished holt winters implementation in scala?

aemelyanenko94 avatar Mar 05 '18 11:03 aemelyanenko94