模型融合
这里我用了Stacking进行融合模型
from mlxtend.classifier import StackingCVClassifier, StackingClassifier
# 构建 Stacking 模型,因为 dt 评分太低了,所以抛弃掉,使用 lr 作为最后的融合模型
s_clf = StackingClassifier(classifiers=[rfc, xgb, svc],
meta_classifier=rfc, use_probas=True, verbose=3)
s_clf.fit(X_train, y_train)
model_metrics(s_clf, X_train, X_test, y_train, y_test)
综合前面的模型得分可以看见,进行融合过的模型在训练集表现的较好,测试集表现的较差,表现出过拟合,整体表现没有前面的随机森林的模型表现的好