IniziaInizia gratis

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

Questo esercizio fa parte del corso

Building Response Models in R

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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

# Obtain the number of purchase events


# Obtain the relative number of purchase events
Modifica ed esegui il codice