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

  Enroll Now

End to End ML Project - Analyze and evaluate best model

Finally, we will make predictions using our model. We will also evaluate those predictions, which is very important so that we can determine how good our model is in predicting attributes it has not seen based on the training it got so far.

  • Set the best_estimator_ that we got from the GridSearchCV results to a variable named final_model

    <<your code goes here>> = grid_search.best_estimator_
  • Now let's drop the labels from the test set that our model will be predicting, save the attributes in a variable called X_test and save the labels in another variable called y_test

    X_test = strat_test_set.drop("median_house_value", axis=1)
    <<your code goes here>> = strat_test_set["median_house_value"].copy()
  • Now let's pass the attributes through the pipeline we created for our model earlier

    X_test_prepared = full_pipeline.transform(X_test)
  • Now, let's make predictions based on the set of data we got from the pipeline and save it in a variable called final_predictions

    final_predictions = final_model.predict(X_test_prepared)
  • Finally, let's compare the predictions of our model against the actual data and see how it performs

    final_mse = mean_squared_error(y_test, final_predictions)
    final_rmse = np.sqrt(final_mse)

Now let's print the final result


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...