gpt4 book ai didi

python - 如何针对 sci-kit 学习库中的某一类别对 SVM 进行惩罚?

转载 作者:行者123 更新时间:2023-11-30 08:41:09 26 4
gpt4 key购买 nike

我一个类有 10000 个样本,而另一类只有 3500 个样本。这就是我面临类不平衡问题的原因。sci-kit 学习库中有 SVM 的惩罚版本吗?

最佳答案

在 SVC 中,fit 方法中的关键字 class-weight 将参数 C 设置为 C*value其中值>0

实际上,class Weight是一个class_label: value形式的字典。

引用http://scikit-learn.org/stable/modules/svm.html (秒:1.4.1.3)

关于python - 如何针对 sci-kit 学习库中的某一类别对 SVM 进行惩罚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40992625/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com