本文介绍了在处理VotingClassifier或Grid搜索时,Sklearn中的GradientBoostingClassifier是否具有类权重(或替代方法)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将GradientBoostingClassifier用于不平衡的标记数据集。在Sklearn中,似乎没有类权重作为此分类器的参数。我看到适合时可以使用sample_weight,但在处理VotingClassifier或GridSearch时不能使用它。

I'm using GradientBoostingClassifier for my unbalanced labeled datasets. It seems like class weight doesn't exist as a parameter for this classifier in Sklearn. I see I can use sample_weight when fit but I cannot use it when I deal with VotingClassifier or GridSearch. Could someone help?

推荐答案

当前没有办法在sklearn中为GB使用class_weights。

Currently there isn't a way to use class_weights for GB in sklearn.

不要将它与sample_weight混淆

Don't confuse this with sample_weight

Sample Weights会改变损失函数和您的得分尝试优化。

Sample Weights change the loss function and your score that you're trying to optimize. This is often used in case of survey data where sampling approaches have gaps.

类别权重用于校正类别不平衡,以代替\欠采样。对于sklearn中的GB,没有直接的方法(不过您可以在Random Forests中做到)

Class Weights are used to correct class imbalances as a proxy for over \ undersampling. There is no direct way to do that for GB in sklearn (you can do that in Random Forests though)

这篇关于在处理VotingClassifier或Grid搜索时,Sklearn中的GradientBoostingClassifier是否具有类权重(或替代方法)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 11:11