Python/机器学习 : Can I combine several prediction models into one

标签 python model machine-learning classification

我正在研究一个预测模型,最初使用的是随机森林算法。我想将不同的预测算法结合起来以提高我的准确性。

我尝试了这个,但出现错误:

models = [RandomForestClassifier(n_estimators=200), GradientBoostingClassifier(n_estimators=100)]
%time cross_val_score(models, X2, Y_target).mean()

错误:

estimator should a be an estimator implementing 'fit' method

有办法做到这一点吗? (有没有比装袋更简单的方法?)

最佳答案

使用VotingClassifier

The idea behind the voting classifier implementation is to combine conceptually different machine learning classifiers and use a majority vote or the average predicted probabilities (soft vote) to predict the class labels.

关于Python/机器学习 : Can I combine several prediction models into one,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37090929/

相关文章:

model-view-controller - 与模型 View 相比, Model View Controller (MVC)有什么优势?

python - 在使用seaborn时的jointplot中,如何在图中设置另一个图例

ruby-on-rails - 限制属性更新,但不限制创建,但更新无法更新时失败

javascript - 如何在Selenium中获取JS生成的文本?

c# - 如何在 View ASP MVC 中使用模型数据?

machine-learning - precision_recall_fscore_support 返回相同的准确度、精确度和召回率值

machine-learning - Keras:引入批量标准化后 NaN 训练损失

python - 在 Python 中使用 PCA 进行图像聚类和降维

python - Scrapy Scraper 不会抓取除比第一页更远的内容

Python:通过函数迭代带有 int(变量)的字符串