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

Preparing for evaluation

In order to measure the validate performance of your models you need compare the predicted values of life_expectancy for the observations from validate set to the actual values recorded. Here you will prepare both of these vectors for each partition.

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

Machine Learning in the Tidyverse

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

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

  • Extract the actual life_expectancy from the validate data frames and store these in the column validate_actual.
  • Predict the life_expectancy for each validate partition using the map2() and predict() functions in the column validate_predicted.

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

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

cv_prep_lm <- cv_models_lm %>% 
  mutate(
    # Extract the recorded life expectancy for the records in the validate data frames
    validate_actual = map(validate, ~.x$___),
    # Predict life expectancy for each validate set using its corresponding model
    validate_predicted = map2(.x = model, .y = validate, ~___(.x, .y))
  )
Редактировать и запускать код