Session Ready
Exercise

Adding interactions to the basetable

Assume that a non-profit organisation wants to launch a campaign in Spain and France, and wants to know which donors are most likely to donate. Given is a basetable with predictive variables "age", "country_Spain", "country_France" and the target "target". For your convenience, a function auc is implemented that returns the AUC on partitioned data, taking two arguments, namely the set of variables considered and the basetable:

auc(["variable_1","variable_2"], basetable)
0.51

In this exercise, you will learn how to add interactions to the basetable and verify whether this improves the AUC of the predictive model.

Instructions
100 XP
  • Print the AUC of a model using age only and the AUC of a model using country_Spain only.
  • Print the AUC of a model using age and country_Spain.
  • Add two interaction terms, namely age with country_Spain and age with country_France to the basetable.
  • Print the AUC of a model using age, country_Spain and the interaction terms.