Plotting one-step-ahead predictions
Now that you have your predictions on the Amazon stock, you should plot these predictions to see how you've done.
You made predictions over the latest 30 days of data available, always forecasting just one day ahead. By evaluating these predictions you can judge how the model performs in making predictions for just the next day, where you don't know the answer.
The lower_limits, upper_limits and amazon DataFrames as well as your mean prediction mean_forecast that you created in the last exercise are available in your environment.
Este exercício faz parte do curso
ARIMA Models in Python
Instruções do exercício
- Plot the
amazondata, using theamazon.indexas the x coordinates. - Plot the
mean_forecastprediction similarly, usingmean_forecast.indexas the x-coordinates. - Plot a shaded area between
lower_limitsandupper_limitsof your confidence interval. Use the index oflower_limitsas the x coordinates.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# plot the amazon data
plt.plot(____, ____, label='observed')
# plot your mean predictions
plt.plot(____, ____, color='r', label='forecast')
# shade the area between your confidence limits
plt.____(____, ____,
____, color='pink')
# set labels, legends and show plot
plt.xlabel('Date')
plt.ylabel('Amazon Stock Price - Close USD')
plt.legend()
plt.show()