Question: Adjust and add Python code to plot the actual stock price with the moving average of the predicted price over a rolling 30 day window.

Adjust and add Python code to plot the actual stock price with the moving average of the predicted price over a rolling 30 day window.

# Visualize the prediction with rolling average

from matplotlib import pyplot as plt

plt.figure()

plt.plot(y_pred_org) #the price prediction over time

plt.plot(y_test_t_org) #the actual price over time

plt.title('Prediction vs Real Stock Price')

plt.ylabel('Price')

plt.xlabel('Days')

plt.legend(['Prediction', 'Real'], loc='upper left')

#plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!