rafalab/dsbook

Code error: Section 72.2: Wrong model's RMSE used

jasbeausejour opened this issue · 1 comments

Hi,

In the last part of section 72.2, we are trying to see if the regularized movie effect yielded better results than the other models. Unfortunately, in the code, we are re-using the RMSE from model 2 instead of using the RMSE from model 3. We then come to the conclusion that the improvement is substantial, but it is not quite that substantial in reality.

RMSE with Movie Effect: 0.986
RMSE with Regularized Movie Effect: 0.9649
RMSE quoted in the book: 0.885

Here's the faulty code:

predicted_ratings <- test_set %>%
left_join(movie_reg_avgs, by='movieId') %>%
mutate(pred = mu + b_i) %>%
.$pred

model_3_rmse <- RMSE(predicted_ratings, test_set$rating)
rmse_results <- bind_rows(rmse_results,
data_frame(method="Regularized Movie Effect Model",
RMSE = model_2_rmse ))

The bolded part should read model_3_rmse

Corrected. Thanks!