BaşlayınÜcretsiz Başlayın

Regression performance

Now you have fit a model, reg, using all features from sales_df, and made predictions of sales values, you can evaluate performance using some common regression metrics.

The variables X_train, X_test, y_train, y_test, and y_pred, along with the fitted model, reg, all from the last exercise, have been preloaded for you.

Your task is to find out how well the features can explain the variance in the target values, along with assessing the model's ability to make predictions on unseen data.

Bu egzersiz

Supervised Learning with scikit-learn

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import root_mean_squared_error.
  • Calculate the model's R-squared score by passing the test feature values and the test target values to an appropriate method.
  • Calculate the model's root mean squared error using y_test and y_pred.
  • Print r_squared and rmse.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import root_mean_squared_error
from ____.____ import ____

# Compute R-squared
r_squared = reg.____(____, ____)

# Compute RMSE
rmse = ____(____, ____)

# Print the metrics
print("R^2: {}".format(____))
print("RMSE: {}".format(____))
Kodu Düzenle ve Çalıştır