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()
.
Este exercício faz parte do curso
Building Response Models in R
Instruções do exercício
- Obtain the model predictions from the
extended.model
object by using the functionfitted()
. Use the functionifelse()
to classify the predictions into1
, if the predicted purchase probability exceeds0.5
, and0
otherwise. Assign the result to an objectpredicted
. - Get the number of purchase events by using the function
table()
. - Get the relative number of purchase events by using the function
mean()
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Classify the predictions
predicted <- ___(___(extended.model) >= ___, ___, ___)
# Obtain the number of purchase events
# Obtain the relative number of purchase events