Churndrivers identificeren en interpreteren

Machine Learning voor marketing in Python

Karolis Urbonas

Head of Analytics & Science, Amazon

Beslisboomregels plotten

from sklearn import tree
import graphviz

exported = tree.export_graphviz( decision_tree=mytree, out_file=None, feature_names=cols, precision=1, class_names=['Not churn','Churn'], filled = True)
graph = graphviz.Source(exported) display(graph)
Machine Learning voor marketing in Python

Beslisboomgrafiek interpreteren

Visualisatie van beslisboom

Machine Learning voor marketing in Python

Coëfficiënten van logistische regressie

  • Logistische regressie geeft bètacoëfficiënten
  • Te lezen als verandering in de log-odds op churn bij +1 in de feature

Logistisch-regressiemodel

Machine Learning voor marketing in Python

Coëfficiënten extraheren (logistische regressie)

  • Coëfficiënten haal je op met .coef_ op het getrainde Logistic Regression-object
    logreg.coef_
    
array([[ 0.        ,  0.09784772,  0.        , -0.03935476, -0.82068131,
        -0.41231806, -0.14319622, -0.01746504, -0.41830733,  0.        ,
         0.        ,  0.07138468,  0.        ,  0.        ,  0.        ,
         0.        , -0.41424363, -0.59539021,  0.        ,  0.18846525,
         0.        , -0.90766135,  0.90151342,  0.        ]])
Machine Learning voor marketing in Python

Coëfficiënten transformeren (logistische regressie)

  • Log-odds zijn lastig te duiden
  • Oplossing: neem de exponent van de coëfficiënten
  • Dit geeft de verandering in odds bij +1 in de feature
coefficients = pd.concat([pd.DataFrame(train_X.columns),
               pd.DataFrame(np.transpose(logit.coef_))], 
               axis = 1)
coefficients.columns = ['Feature', 'Coefficient']

coefficients['Exp_Coefficient'] = np.exp(coefficients['Coefficient'])
coefficients = coefficients[coefficients['Coefficient']!=0] print(coefficients.sort_values(by=['Coefficient']))
Machine Learning voor marketing in Python

Betekenis van getransformeerde coëfficiënten

Logistische-regressiecoëfficiënten

Machine Learning voor marketing in Python

Laten we oefenen!

Machine Learning voor marketing in Python

Preparing Video For Download...