Login using Social Account
     Continue with GoogleLogin using your credentials
Now that we have a well-trained model in our hands, let's evaluate its performance on the testing data. First, we'll need to preprocess the test data and make it in a format acceptable to our ML model.
Then we'll simply predict the target variable for our testing data and analyze the performance of our model on it.
Drop the target variable from the testing data strat_test_set
and store the output (predictors) in a variable named X_test
.
Store the target variable of our testing data strat_test_set
in a variable named y_test
using the copy()
method of our DataFrame object.
Transform the testing predictors X_test
by passing it through our pipeline full_pipeline
by using the transform()
method. Don't call either the fit()
or fit_transform()
method for the testing data as you don't want to fit the pipeline with our testing data. Store the output in a variable named X_test_prepared
.
Get our model by using the attribute best_estimator_
on object grid_search
and store it in a variable named final_model
.
Predict the target variable for our dataset X_test_prepared
using the predict()
method on our model final_model
and store the output in a variable final_predictions
.
Calculate the RMSE value for our model and store it in a variable final_rmse
.
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Loading comments...