Meaning of evolution
In this exercise you will investigate the link between the variable "donations2017min_2016" that you added to the basetable
in the previous exercises and the target, using a predictor insight graph.
For your convenience, the methods to create the predictor insight graph are pre-programmed.
To plot the predictor insight graph of a continuous variable variable
in a basetable
, you can follow these steps:
- Discretize the variable in
n_bins
bins:
basetable["variable_disc"] = pd.qcut(basetable["variable"], n_bins)
- Construct the predictor insight graph table:
pig_table = create_pig_table(basetable, "target","variable_disc")
- Plot the predictor insight graph based on this table:
plot_pig(pig_table,"variable_disc")
This exercise is part of the course
Intermediate Predictive Analytics in Python
Exercise instructions
- Discretize the evolution variable
donations_2017_min_2016
in 5 bins and add it to the basetable. - Create the predictor insight graph table for this variable.
- Plot the predictor insight graph of this variable.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Discretize the variable in 5 bins and add to the basetable
basetable["donations_2017_min_2016_disc"] = pd.____(____["____"], ____)
# Construct the predictor insight graph table
pig_table = ____(____, "target", "____")
# Plot the predictor insight graph
plot_pig(____, "____")