MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Dimensionality Reduction in R

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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
___(___)
Edit dan Jalankan Kode