金融数据6

模型融合

这里我用了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)

在这里插入图片描述
综合前面的模型得分可以看见,进行融合过的模型在训练集表现的较好,测试集表现的较差,表现出过拟合,整体表现没有前面的随机森林的模型表现的好

猜你喜欢

转载自blog.csdn.net/chen19830/article/details/88410970