Session Ready
Exercise

Classifications

The management of the brewery cannot really deal with "purchase probabilities". They want to have a model that predicts purchases. One way to solve this issue is to classify the predicted probabilities into predicted purchase events for Hoppiness.

You obtain the predicted purchase probabilities by using the function fitted() on the extended.model object. You naively classify the predictions into 1, if the predicted purchase probability exceeds 0.5, and 0 otherwise. The function ifelse() allows you to do this. Afterwards, you summarize the classified purchase events by using the functions table(). The relative number of purchase events can be obtained by additionally using mean().

Instructions
100 XP
  • Obtain the model predictions from the extended.model object by using the function fitted(). Use the function ifelse() to classify the predictions into 1, if the predicted purchase probability exceeds 0.5, and 0 otherwise. Assign the result to an object predicted.
  • Get the number of purchase events by using the function table().
  • Get the relative number of purchase events by using the function mean()