Exponential smoothing

Is there any package in Julia to do exponential smoothing?

I’m not aware of one, but it should be a 1-liner using TimeSeries

There is https://github.com/gragusa/ExponentialSmoothing.jl. No docs, but it should work.

1 Like

Thank you. Can you write a small example of using your package?

OnlineStats does this: Weights · OnlineStats Docs

e.g.

julia> using OnlineStats

julia> x = randn(100);

julia> o = Mean(weight=ExponentialWeight(.1))
Mean: n=0 | value=0.0

julia> exp_smooth = [value(fit!(o, xi)) for xi in x]
4 Likes

Thank you, Josh. It works perfectly. Great job on the animation! Do you know if ExponentialWeight() is the same as the smoothing factor, generally denoted by alpha?

I am trying to determine the optimal value for this factor, do you know of a way to do that in Julia. In R, forecast.HoltWinters does the job.

Yes, for Mean the weight is the “smoothing factor”. Note that any weight is just a function of the number of observations, so you can also use

Mean(weight = n -> .1)

Choosing the value is pretty subjective. I’m not familiar with those methods or what metric they are trying to optimize.

1 Like

@ayushpatnaikgit GitHub - LAMPSPUC/StateSpaceModels.jl: StateSpaceModels.jl is a Julia package for time-series analysis using state-space models. has an implementation of the state space approach for exponential smoothing. Manual · StateSpaceModels.jl

1 Like

Hi @guilhermebodin, thank you for the excellent package. I am using it. I am also using the Kalman filter that you’ve written. I think it’ll be useful to have something similar to the tsclean function in the R Forecast by Hyndman. Is there a slack channel for the package? I could not find.

@ayushpatnaikgit Nice to hear that you liked the package!

There is not a slack channel but we can create it. Another option is to use the statistics channel or put questions here on discourse. If you want to discuss new features you can also message me on slack