ComeçarComece de graça

Performance of evolution variables

Given is a basetable that has 3 regular predictive variables, namely "gender_F", "age", "donations_2017", and an evolution variable "donations_2017_min_2016" that contains the number of donations made in 2017 minus the number of donations made in 2016.

In this exercise you will see the added value of using evolution variables. You will construct two predictive models, one using the regular predictive variables given for you in variables_regular and one replacing "donations_2017" by "donations_2017_min_2016", these variables are given for you in variables_evolution. The logistic regression model is already initialized for you in logreg. The model using the regular variables has already been implemented, the AUC is in auc_regular.

Este exercício faz parte do curso

Intermediate Predictive Analytics in Python

Ver curso

Instruções do exercício

  • Select the evolution variables in X_evolution and fit the model.
  • Make predictions using .predict_proba() using this model for all observations in X_evolution and calculate the AUC with roc_auc_score().
  • Print the AUCs of both models and compare.

Exercício interativo prático

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

# Select the evolution variables and fit the model
X_evolution = ____[____]
logreg.fit(____, y)

# Make predictions and calculate the AUC
predictions_evolution = logreg.____(____)[:,1]
auc_evolution = ____(____, ____)

# Print the respective AUC values
print(round(auc_regular, 2))
____(round(____, 2))
Editar e executar o código