深度森林:常见Warning及解决方案

本人最近使用周志华的深度森林算法去解决一些问题,于是在github上下载了官方的Gcforest程序,下载地址:https://github.com/kingfengji/gcForest

运行之后发现了一些Warning,有时会导致程序无法运行,下面给出两种常见的Warning和解决方案。

1. FutureWarning

 (1) FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.

 (2) FutureWarning: Default multi_class will be changed to 'auto' in 0.22. Specify the multi_class option to silence this warning. "this warning.", FutureWarning).

我在第一次运行这个程序的时候,就遇到了这两个警告。原因是因为原先的代码:

     ca_config["estimators"].append({"n_folds": 5, "type": "LogisticRegression"})

逻辑回归中没有具体指明solver和multi_class,而LogisticRegression的solver一般有liblinear,lbfgs,newton-cg,sag(具体可自行百度),所以在此我将这行代码改为

     ca_config["estimators"].append({"n_folds": 5, "type": "LogisticRegression",
                                     "solver": "lbfgs",
                                     "multi_class": "auto"
                                    })

就消除了这个Warning(solver可根据数据情况自行设定,不一定非要lbfgs)。

2. ConvergenceWarning

ConvergenceWarning: lbfgs failed to converge. Increase the number of iterations. "of iterations.", ConvergenceWarning)

在消除第一个警告之后,又来了一个新警告(收敛警告),说的是lbfgs 无法收敛,要求增加迭代次数。LogisticRegression里有一个max_iter(最大迭代次数)可以设置,默认为1000。所以在此可以将其设为3000。所以将上面那段代码完善一下改为:

    ca_config["estimators"].append({"n_folds": 5, "type": "LogisticRegression",
                                     "solver": "lbfgs",
                                     "multi_class": "auto",
                                     "max_iter" : 3000
                                    })


             就消除了这个Warning。

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值