Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

Visualizing Predictions vs Ground Truths

Let us now plot the predicted stock prices vs the actual ground truth values.

We shall use model.predict() to get the predicted values of the test data set.

  • Use predict method on model and pass testX as the argument.

    pred = model.<< your code comes here >>
  • Since we have scaled the actual values of the dataset, we need to inverse transform the values. So, inverse transform the predicted values using scaler.inverse_transform() and pass the pred as an argument.

    pred = << your code comes here >>(pred)
  • Now, reshape the test set and inverse transform the test set values.

    testY_actual = testY.reshape(testY.shape[0] , 1)
    testY_actual = scaler.inverse_transform(testY_actual)
  • Let us now use pred and testY_actual and visualize their graphs to depict the predicted and actual values with respect to time.

    plt.plot(testY_actual , 'b')
    plt.plot(pred , 'r')
    plt.ylabel('Stock Prices')
    plt.title('Check the performance of the model with time')
    plt.legend(['Actual', 'Predicted'], loc='upper left')

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...