Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something is wrong #35

Open
y913403515 opened this issue May 28, 2019 · 2 comments
Open

Something is wrong #35

y913403515 opened this issue May 28, 2019 · 2 comments
Assignees

Comments

@y913403515
Copy link

When I run java-timeseries with the following data, something is wrong.

double[] sales = new double[] {3.0, 3.0, 7.0, 2.0, 2.0, 1.0, 0.0, 3.0, 4.0, 3.0, 2.0, 3.0, 6.0, 1.0, 
                                                0.0, 3.0, 4.0, 2.0, 2.0, 0.0, 1.0};
long season = 8l;

TimePeriod   day = TimePeriod.oneDay();
TimeSeries   series = TimeSeries.from(day, sales);
TimePeriod   timePeriod = new TimePeriod(TimeUnit.DAY, season);
ArimaOrder   order = ArimaOrder.order(3, 1, 2, 1, 1, 2);
Arima             model = Arima.model(series, order, timePeriod);

Forecast forecast = model.forecast(7);
TimeSeries forecastValue = forecast.pointEstimates();
double[] forecastValuesArray = forecastValue.asArray();

 for ( double  forecastValue : forecastValuesArray) {
                System.out.println(forecastValue);
            }

Then the printed results are all NaN.

Thanks!

@MuhYusuf93
Copy link

@y913403515 yeah me too :(

@signaflo signaflo self-assigned this Oct 29, 2019
@signaflo
Copy link
Owner

Sorry for the late response @y913403515. I'm just getting back to this project after a long time away.

You need to have more observations than the length of your seasonal cycle. For example, it wouldn't make sense to fit a monthly seasonal model with only 4 observations, which is roughly equivalent to what you're trying to do here.

Ideally, the number of observations you have should be at least twice the length of your seasonal cycle. So, in case your cycle is 81 days long, you should have 162 observations, but even then your forecast is going to be very unreliable. Think of fitting a seasonal model with only two years worth of monthly data. It's not enough data to learn from.

I'm not going to close this issue because one, I would like to see if I can give a better explanation of why this doesn't work, and two, there needs to be an error message in this circumstance instead of pumping out NaN values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants