局部匹配地使用sklearn投票合奏 [英] Using sklearn voting ensemble with partial fit

查看:86
本文介绍了局部匹配地使用sklearn投票合奏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何使用局部拟合在sklearn中使用合奏. 我不想重新训练我的模型. 或者,我们可以通过预先训练的模型进行整合吗? 我已经看到例如投票分类器不支持使用局部拟合的训练.

Can someone please tell how to use ensembles in sklearn using partial fit. I don't want to retrain my model. Alternatively, can we pass pre-trained models for ensembling ? I have seen that voting classifier for example does not support training using partial fit.

推荐答案

Mlxtend库具有VotingEnsemble的实现,该实现允许您传入预先拟合的模型.例如,如果您有三个预先训练的模型clf1,clf2,clf3.以下代码将起作用.

The Mlxtend library has an implementation of VotingEnsemble which allows you to pass in pre-fitted models. For example if you have three pre-trained models clf1, clf2, clf3. The following code would work.

from mlxtend.classifier import EnsembleVoteClassifier
import copy
eclf = EnsembleVoteClassifier(clfs=[clf1, clf2, clf3], weights=[1,1,1], refit=False)

当设置为false时,EnsembleVoteClassifier中的 refit 参数可确保不对分类器进行调整.

When set to false the refit argument in EnsembleVoteClassifier ensures that the classifiers are not refit.

通常,当寻找sci-kit learning无法提供的更高级的技术功能时,请以mlxtend作为第一参考点.

In general, when looking for more advanced technical features that sci-kit learn does not provide, look to mlxtend as a first point of reference.

这篇关于局部匹配地使用sklearn投票合奏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆