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

ARIMA forecast errors if p and q are both zero

Open sryza opened this issue 8 years ago • 5 comments

val arimaModel = ARIMA.fitmodel(0,0,0,ts,true,"css-cgd", z)

z is double array with value z(0)= 2127.399 (intercept value)

This function run fine. But when I try to run the forecast from the arimamodel object I get the following error val getForecast=arimaModel.forecast(ts,5)

Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Vectors must have same length: 0 != 34 at scala.Predef$.require(Predef.scala:233) at breeze.linalg.DenseVector$$anon$6.apply(DenseVector.scala:581) at breeze.linalg.DenseVector$$anon$6.apply(DenseVector.scala:579) at breeze.linalg.NumericOps$class.$colon$eq(NumericOps.scala:59) at breeze.linalg.DenseVector.$colon$eq(DenseVector.scala:50) at com.cloudera.sparkts.models.ARIMAModel.forecast(ARIMA.scala:691) at org.cloudera.spark.streaming.kafka.SingleSeriesARIMA$.main(SingleSeriesARIMA.scala:46) at org.cloudera.spark.streaming.kafka.SingleSeriesARIMA.main(SingleSeriesARIMA.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

The highlighted line is below forward(0 until maxLag) := hist(-maxLag to -1)

For the given parameters, the line would look like below forward(0 until 0) := hist(-0 to -1)

The length of forward will be 0 The length of hist will be 34. Hence, the program errors out.

sryza avatar Mar 29 '16 17:03 sryza

So, I've tried to solve this problem. Please see may pullrequest.

TiagoDinisFonseca avatar Oct 13 '16 15:10 TiagoDinisFonseca

Is this closed or still in progress? Could you please update the plan for merging? I have been getting the same error.

nikitaGoyal2 avatar Sep 05 '17 07:09 nikitaGoyal2

Is this issue still open?

neeleshkshukla avatar Oct 16 '18 19:10 neeleshkshukla

@sryza @TiagoDinisFonseca When is the next release of spark-ts library. Changes of this bug is not there in latest release.

neeleshkshukla avatar Oct 22 '18 06:10 neeleshkshukla

@neeleshkshukla this commit has been in the master since Nov 25, 2016. Please check https://github.com/sryza/spark-timeseries/pull/171/commits.

If you are seeing a similar bug, please open a bug.

Anyway, I'm not active here as I explained in the pull request.

Best regards, Tiago

TijoloAzul avatar Oct 23 '18 17:10 TijoloAzul