Resolved: Passing training data in prediction isn't odd as it could cause overfitting to the model
At timestamp 3:10
y_hat = reg.predict(x_train) # used to predict value isn't this overfit data # or predicting same values which our model already know # as we trained it on the same data how is this even justifiable # i guess this must y_hat = reg.predict(x_test)
same follows in visualization part too
Thank you for reaching out!
In the lecture Linear Regression Practical Example (Part 4), the instructor is creating the model, training it, and demonstrating how it performs on the training data. Often, the
predict() method is used on the training data to cross-validate a model (a topic not covered in this introductory course).
In the following lesson, Linear Regression Practical Example (Part 5), the instructor will test the model on the test data by creating a variable
y_hat_test = reg.predict(x_test)