Labs - Week 4

We will be using the add-on package discrim to access functions to perform discriminant analysis models with parsnip and the klaR package to perform the QDA calculations. if you haven’t already got it installed run

install.packages(c("discrim", "klaR"))

Create a test-train rsplit object of mlc_churn using initial_split(). Use the arguments to set the proportions of the training data to be 80%. Stratify the sampling according to the churn variable.

Do the following tasks for LDA, QDA and KNN model.

  1. Fit a classification model. Use number_vmail_messages, total_intl_minutes, total_intl_calls, total_intl_charge, number_customer_service_calls as predictors. Remember to fit the model only using the training data set.
  2. Inspect the model with summary() and tidy(). How good are the variables we have chosen?
  3. Predict values for the testing data set.
  4. Use conf_mat() to construct a confusion matrix. Does the confusion matrix look good?