Aan de slagGa gratis aan de slag

Plotting dynamic forecasts

Time to plot your predictions. Remember that making dynamic predictions, means that your model makes predictions with no corrections, unlike the one-step-ahead predictions. This is kind of like making a forecast now for the next 30 days, and then waiting to see what happens before comparing how good your predictions were.

The lower_limits, upper_limits and amazon DataFrames as well as your mean predictions mean_forecast that you created in the last exercise are available in your environment.

Deze oefening maakt deel uit van de cursus

ARIMA Models in Python

Cursus bekijken

Oefeninstructies

  • Plot the amazon data using the dates in the index of this DataFrame as the x coordinates and the values as the y coordinates.
  • Plot the mean_forecast predictions similarly.
  • Plot a shaded area between lower_limits and upper_limits of your confidence interval. Use the index of one of these DataFrames as the x coordinates.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# plot the amazon data
plt.plot(____, ____, label='observed')

# plot your mean forecast
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 bewerken en uitvoeren