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

Evaluate the 10-fold CV error

In this exercise, you'll evaluate the 10-fold CV Root Mean Squared Error (RMSE) achieved by the regression tree dt that you instantiated in the previous exercise.

In addition to dt, the training data including X_train and y_train are available in your workspace. We also imported cross_val_score from sklearn.model_selection.

Note that since cross_val_score has only the option of evaluating the negative MSEs, its output should be multiplied by negative one to obtain the MSEs. The CV RMSE can then be obtained by computing the square root of the average MSE.

Bu egzersiz

Machine Learning with Tree-Based Models in Python

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

Egzersiz talimatları

  • Compute dt's 10-fold cross-validated MSE by setting the scoring argument to 'neg_mean_squared_error'.

  • Compute RMSE from the obtained MSE scores.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Compute the array containing the 10-folds CV MSEs
MSE_CV_scores = - ____(____, ____, ____, cv=____, 
                       ____='____',
                       n_jobs=-1)

# Compute the 10-folds CV RMSE
RMSE_CV = (____.____)**(____)

# Print RMSE_CV
print('CV RMSE: {:.2f}'.format(RMSE_CV))
Kodu Düzenle ve Çalıştır