signaflo / java-timeseries

Time series analysis in Java
MIT License
195 stars 49 forks source link

Hello Signaflo, For one weekly time series it is taking (18-20)sec to compute the results. Is there any way to optimize the computation time. #24

Open Sayan-Pal585 opened 6 years ago

Sayan-Pal585 commented 6 years ago

Can you help me with this problem?

signaflo commented 6 years ago

@Sayan-Pal585 , are you available to share the data you're using? Have you tried running something similar in R? The problem is likely due to using the maximum likelihood method to optimize coefficients for weekly data leads to using large matrices in the internal Kalman Filter algorithm, which leads to much longer running times than if you were using monthly data.

One potential quick fix is to use the CSS (conditional sum-of-squares) method, which if you have a lot of data, will give you results close to those obtained with maximum likelihood (ML).

Sayan-Pal585 commented 6 years ago

@signaflo I have attached the weekly time series. In R it is perfectly running fine.
Weekly_TS.zip

Sayan-Pal585 commented 6 years ago

Time taken by various model parameters with different fitting strategy css fitting strategy:->>>>>>>>>>>>>>>>>>>> order : - 21111 run time: -362 ms order: - 111111 run time: -319 ms order - 312112 run time: - 500ms order - 515112 run time - 725ms order - 515411 run time - 513ms order - 515414 run time - 582ms

ML fitting strategy:->>>>>>>>>>>>>>>>>>>> order : - 21111 run time: - 02:14 mints order: - 111111 run time : 02:10 mints order - 312112 run time: - 15:12mints

CSSML fitting strategy:->>>>>>>>>>>>>>>>>>>> order - 21111 run time: - 01:47 mints order - 111111 run time: -01:11 mints order - 312112 run time - 12:15 mints

Sayan-Pal585 commented 6 years ago

Is there any way that I can reduce the time for ML & CSS-ML fitting strategy.?

Sayan-Pal585 commented 6 years ago

I found that the optimizer function "BFGS" is taking more time. For "CSS-ML" without "BFGS" it is taking 2 sec & similar time for "ML". Is there any way to optimize "BFGS" itself.