Get startedGet started for free

Fitting a logistic regression model

In addition to regression models, the parsnip package also provides a general interface to classification models in R.

In this exercise, you will define a parsnip logistic regression object and train your model to predict canceled_service using avg_call_mins, avg_intl_mins, and monthly_charges as predictor variables from the telecom_df data.

The telecom_training and telecom_test tibbles that you created in the previous lesson have been loaded into this session.

This exercise is part of the course

Modeling with tidymodels in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Specify a logistic regression model
logistic_model <- ___ %>% 
  # Set the engine
  ___ %>% 
  # Set the mode
  ___

# Print the model specification
logistic_model
Edit and Run Code