LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

ARIMA Models in Python

Kurs anzeigen

Anleitung zur Übung

  • Plot the amazon data, using the amazon.index as the x coordinates.
  • Plot the mean_forecast prediction similarly, using mean_forecast.index as the x-coordinates.
  • Plot a shaded area between lower_limits and upper_limits of your confidence interval. Use the index of lower_limits as the x coordinates.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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()
Code bearbeiten und ausführen