营销分析:用 Python 预测客户流失
Mark Peterson
Director of Data Science, Infoblox
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)
| 参数 | 作用 |
|---|---|
| n_estimators | 树的数量 |
| criterion | 划分质量 |
| max_features | 寻找最佳划分时的特征数 |
| max_depth | 树的最大深度 |
| min_sample_splits | 划分节点的最小样本数 |
| bootstrap | 是否使用自助采样 |
from sklearn.model_selection import GridSearchCVparam_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
营销分析:用 Python 预测客户流失