1. Learn
  2. /
  3. Courses
  4. /
  5. Modeling with tidymodels in R

Connected

Exercise

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.

Instructions 1/2

undefined XP
    1
    2
  • Initialize a logistic regression object, logistic_model, with the appropriate parsnip function.
  • Use the 'glm' engine.
  • Set the mode to 'classification'.
  • Print the logistic_model object to view its specification details.