过拟合解决方法python,如何解决Python sklearn随机森林中的过拟合问题?

博客讨论了使用Python sklearn的RandomForestClassifier遇到的过拟合问题。通过交叉验证显示训练集准确率高而测试集准确率低。作者提到可能的解决方案包括增加`n_estimators`数量,减少`max_features`,限制`max_depth`,以及设置`min_samples_leaf`大于1。建议采用科学的方法调整参数,如使用训练集、开发集和测试集,并逐一更改参数或利用gridsearch进行参数搜索。
摘要由CSDN通过智能技术生成

I am using RandomForestClassifier implemented in python sklearn package to build a binary classification model. The below is the results of cross validations:

Fold 1 : Train: 164 Test: 40

Train Accuracy: 0.914634146341

Test Accuracy: 0.55

Fold 2 : Train: 163 Test: 41

Train Accuracy: 0.871165644172

Test Accuracy: 0.707317073171

Fold 3 : Train: 163 Test: 41

Train Accuracy: 0.889570552147

Test Accuracy: 0.585365853659

Fold 4 : Train: 163 Test: 41

Train Accuracy: 0.871165644172

Test Accuracy: 0.756097560976

Fold 5 : Train: 163 Test: 41

Train Accuracy: 0.883435582822

Test Accuracy: 0.512195121951

I am using "Price" feature to predict "quality" which is a ordinal value. In each cross validation, there are 163 training examples and 41 test examples.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值