python start函数_python – 如何使用warm_start

基本模式(取自Miriam的回答):

clf = RandomForestClassifier(warm_start=True)

clf.fit(get_data())

clf.fit(get_more_data())

将是API正确的用法.

但这里有一个问题.

正如文档所说:

When set to True, reuse the solution of the previous call to fit and add more estimators to the ensemble, otherwise, just fit a whole new forest.

这意味着,warm_start唯一可以为你做的就是添加新的DecisionTree.所有以前的树木似乎都没有受到影响!

n_more_estimators = self.n_estimators - len(self.estimators_)

if n_more_estimators < 0:

raise ValueError('n_estimators=%d must be larger or equal to '

'len(estimators_)=%d when warm_start==True'

% (self.n_estimators, len(self.estimators_)))

elif n_more_estimators == 0:

warn("Warm-start fitting without increasing n_estimators does not "

"fit new trees.")

这基本上告诉我们,在接近新的合适之前,您需要增加估算器的数量!

我不知道sklearn在这里的用途是什么.我不确定,如果适合,增加内部变量和再次拟合是正确的用法,但我不知何故怀疑它(特别是因为n_estimators不是公共类变量).

你的基本方法(关于这个库和这个分类器)对你的核心学习可能不是一个好主意!我不会进一步追求这一点.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值