ComenzarEmpieza gratis

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 ejercicio forma parte del curso

Building Response Models in R

Ver curso

Instrucciones del ejercicio

  • 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.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Obtain the observed purchases
observed <- ___

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

# Cross-tabulate observed vs. predicted purchases
___(___(predicted, observed))
Editar y ejecutar código