LoslegenKostenlos loslegen

Fit, explore, and evaluate the model

Once you have defined a workflow with a recipe and a model, you can fit the data to the workflow. This is done with the training data set. The trained model is then evaluated using the test set. In this example, the target variable is categorical and you are using a logistic regression model. So you will evaluate the test predictions using the F measure. feature_selection_recipe, lr_model, attrition_wflow, train, and test from the previous exercise are available for your use.

The tidyverse and tidymodels packages have been loaded for you.

Diese Übung ist Teil des Kurses

Dimensionality Reduction in R

Kurs anzeigen

Anleitung zur Übung

  • Fit attrition_wflow using the training data.
  • Add the test predictions to the test data with the original Attrition values.
  • Use f_meas() to evaluate the model's performance on the test data.
  • Display the model estimates of attrition_fit.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Fit workflow to train data
attrition_fit <- 
  ___ %>% ___(___ = ___)

# Add the test predictions to the test data
attrition_pred_df <- ___(___, ___) %>% 
  bind_cols(___ %>% select(___))

# Evaluate F score
___(___, ___, ___)

# Display model estimates
___(___)
Code bearbeiten und ausführen