LinearSVC中参数class_weight的最佳值是什么?

问题描述 投票:0回答:1

我有一个多标签数据(有些类有2个标签,有10个标签),我的模型对均衡值和无值过度拟合。为class_weight参数设置的最佳值是什么?

from sklearn.svm import LinearSVC
svm = LinearSVC(C=0.01,max_iter=100,dual=False,class_weight=None,verbose=1)
python scikit-learn svm libsvm scikit-multilearn
1个回答
0
投票

class_weight参数实际上通过以下方式控制C参数:

class_weight:{dict,'balanced'},可选

设置参数C对于SVC,将类i设置为class_weight[i]*C。如果未给出,则所有类都是应该重一。 “平衡”模式使用y的值自动调整与班级成反比的权重输入数据中的频率为n_samples / (n_classes * np.bincount(y))

尝试将class_weight保持不变,例如在C上演奏。 C = 0.1

© www.soinside.com 2019 - 2024. All rights reserved.