ComeçarComece de graça

Model confusion

On demand, you built a naive classifier. The brewery's management wants to work with these figures to adjust their marketing plan. So, is your classification really correct?

By cross-tabulating the observed vs. the classified purchase events you can check the performance of your classifier. Cross-tabulation can be done by using the function table() on the predicted purchase events together with the true observed purchases. To obtain relative numbers, you additionally divide the table by the total number of observations. Alternatively, you can use the function prop.table() to convert the numbers in the table into relative numbers.

Este exercício faz parte do curso

Building Response Models in R

Ver curso

Instruções do exercício

  • Obtain the observed purchases for HOPPINESS from choice.data and assign them to an object observed.
  • Cross-tabulate the observed and predicted data vectors by using the function table(). Divide the result by 2798.
  • Cross-tabulate the observed and predicted data vectors by using the function table(). Apply the function prop.table() on the result.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Obtain the observed purchases
observed <- ___

# Cross-tabulate observed vs. predicted purchases
___(predicted, observed)/___

# Cross-tabulate observed vs. predicted purchases
___(___(predicted, observed))
Editar e executar o código