CommencerCommencer gratuitement

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().

Cet exercice fait partie du cours

Building Response Models in R

Afficher le cours

Instructions

  • 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()

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Classify the predictions
predicted <- ___(___(extended.model) >= ___, ___, ___)

# Obtain the number of purchase events


# Obtain the relative number of purchase events
Modifier et exécuter le code