使用sklearn实现baggingclassifier

性感官方,在线文档

from sklearn.ensemble import BaggingClassifier as bagc

参数:

base_estimator基学习器
n_estimators基学习器的数量
max_samples每次训练基学习器时使用的样本比例
max_features每次训练基学习器时使用的特征比例
bootstrap:抽取样本后放回
bootstrap_features:抽取特征后放回
oob_score:使用带外样本做评估
warm_start:简单的说,True时新建一个模型会利用上一个模型的“经验”。False时则是纯的全新模型。
n_jobs:土豪万岁
random_state:random_state

属性:

base_estimator:基学习器
n_features_:使用的特征数量
estimators_:所有的基学习器list
oob_score_:带外数据评估分数

方法

.fit 训练
predict 预测
predict_proba预测,返回概率
predict_log_proba 预测,返回log概率
score 返回准确率

猜你喜欢

转载自blog.csdn.net/weixin_44414593/article/details/107544672
今日推荐