What is y_pred?

  1. y_test: The observed target from the training dataset.
  2. y_pred: The predicted target from the model.
    Does the above “y_pred” mean that after training the model using X_train & y_train data and eventually put it to test on X_test & y_test data, then finally the model is used to predict target data by using y_train data (which is now termed as y_test data)?

Course Name: Machine Learning for Options Trading, Section No: 6, Unit No: 16, Unit type: Notebook

No. First, the model is trained using X_train and y_train. After training, the model predicts using X_test — the unseen feature data. These predictions are called y_pred. y_test is used only to check how accurate the predictions are and to create the classification report. Let me know if it’s not clear.

How is y_test being used to check on the accuracy of y_pred? What does it really mean?

y_test contains the actual correct labels for the test data, and y_pred contains the model’s predictions. By comparing the two, we can see how well the model performed—specifically, how often the predicted values matched the true labels in y_test and how often they didn’t. This comparison lets us calculate metrics like accuracy, precision, and recall, which give a sense of the model’s performance on data it hasn’t seen before. Let me know if it’s not clear.