我正在研究一个预测模型,最初使用的是随机森林算法。我想将不同的预测算法结合起来以提高我的准确性。
我尝试了这个,但出现错误:
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/