НачатьНачать бесплатно

Calculate test set RMSE by hand

Now that you have predictions on the test set, you can use these predictions to calculate an error metric (in this case RMSE) on the test set and see how the model performs out-of-sample, rather than in-sample as you did in the first exercise. You first do this by calculating the errors between the predicted diamond prices and the actual diamond prices by subtracting the predictions from the actual values.

Once you have an error vector, calculating RMSE is as simple as squaring it, taking the mean, then taking the square root:

sqrt(mean(error^2))

Это упражнение является частью курса

Machine Learning with caret in R

Посмотреть курс

Инструкции к упражнению

test, model, and p are loaded in your workspace.

  • Calculate the error between the predictions on the test set and the actual diamond prices in the test set. Call this error.
  • Calculate RMSE using this error vector, just printing the result to the console.

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# Compute errors: error


# Calculate RMSE
Редактировать и запускать код