Ajuster votre modèle

Marketing Analytics : prédire l’attrition client en Python

Mark Peterson

Director of Data Science, Infoblox

Rappel

from sklearn.svm import SVC

svc = SVC()

svc.fit(telco['data'], telco['target'])
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
  decision_function_shape='ovr', degree=3, gamma='scale', kernel='rbf',
  max_iter=-1, probability=False, random_state=None, shrinking=True,
  tol=0.001, verbose=False)
Marketing Analytics : prédire l’attrition client en Python

Hyperparamètres de la forêt aléatoire

Paramètre Objectif
n_estimators Nombre d'arbres
criterion Qualité de la séparation
max_features Nombre de variables pour la meilleure séparation
max_depth Profondeur maximale de l'arbre
min_sample_splits Minimum d'échantillons pour scinder un nœud
bootstrap Utilisation d'échantillons Bootstrap
Marketing Analytics : prédire l’attrition client en Python

Recherche par grille

Marketing Analytics : prédire l’attrition client en Python

Recherche par grille avec sklearn

from sklearn.model_selection import GridSearchCV

param_grid = {'n_estimators': np.arange(10, 51)}
clf_cv = GridSearchCV(RandomForestClassifier(), param_grid)
clf_cv.fit(X, y)
clf_cv.best_params_
{'n_estimators': 43}
clf_cv.best_score_
0.9237923792379238
Marketing Analytics : prédire l’attrition client en Python

Bon réglage !

Marketing Analytics : prédire l’attrition client en Python

Preparing Video For Download...