Python Forum

Full Version: Urgent:help about prediction size
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
I'm a bit new to pyhton. In my jupyter lab code, I'm working on time series project. The code below doesn't give last 2 prediction from test tes (I should have 2 more prediction as last 2 rows of test set). I cannot find where the problem is although I tried many things. I would really appreciate If you can help and have and idea on it? I attach it as picture as well as the codes below.

start=len(train)
end=len(train)+len(test)-1
pred=model_fit.predict(start=start,end=end,typ='levels').rename('SARIMA predictions')
pred.plot(legend=True)
test['Mindex'].plot(legend=True)
print(pred)

2023-01-01 96.906580
2023-02-01 101.013176
2023-03-01 110.153657
2023-04-01 107.056124
2023-05-01 110.506556
2023-06-01 112.223209
2023-07-01 106.282959
2023-08-01 106.446757
2023-09-01 110.362227
2023-10-01 114.193317
Freq: MS, Name: SARIMA predictions, dtype: float64
What makes you think you are not getting the last two predictions?
(Apr-29-2024, 11:36 AM)deanhystad Wrote: [ -> ]What makes you think you are not getting the last two predictions?

In my first post I attached the screenshot. In blue line in plot, there are no last two predicitions. This is important because in othe line I cannot calculate MSE, MAE error rates since no last two predictions.
When I look at the plot I see two lines with different x axis values. The number of points looks to be the same.
(Apr-29-2024, 01:04 PM)deanhystad Wrote: [ -> ]When I look at the plot I see two lines with different x axis values. The number of points looks to be the same.

blue line doesn't go paralelly with the orange line although it has to go normally. I dont know what is the problem in the code above.
You should compare the values returned by model_fit.predict against the values in test['Mindex']. Maybe that will help you identify the problem.

I have no clue. You don't show how you create the model, or even what the model is. I don't know what the relationship is between predicted outputs and test[Mindex]. Is test[Mindex] also values for the first 10 days in January 2023, or is it the first 10 months? You need to provide a lot more info before anyone can help.