LoslegenKostenlos loslegen

Build final classification model

Comparing the recall performance between the logistic regression model (0.4) and the best performing random forest model (0.2), you've learned that the model with the best performance is the logistic regression model. In this exercise, you will build the logistic regression model using all of the train data and you will prepare the necessary vectors for evaluating this model's test performance.

Diese Übung ist Teil des Kurses

Machine Learning in the Tidyverse

Kurs anzeigen

Anleitung zur Übung

  • Build a logistic regression model predicting Attrition using all available features in the training_data.
  • Prepare the binary vector of actual test values, test_actual.
  • Prepare the binary vector of predicted values where a probability greater than 0.5 indicates TRUE and store this as test_predicted.

Interaktive Übung

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

# Build the logistic regression model using all training data
best_model <- glm(formula = ___, 
                  data = ___, family = "binomial")


# Prepare binary vector of actual Attrition values for testing_data
test_actual <- testing_data$___ == "___"

# Prepare binary vector of predicted Attrition values for testing_data
test_predicted <- predict(___, ___, type = "response") > ___
Code bearbeiten und ausführen