【问题标题】:How to penalize the SVM for one category in sci-kit learn library?如何在 sci-kit 学习库中惩罚一个类别的 SVM?
【发布时间】:2017-04-20 22:19:55
【问题描述】:

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

【问题讨论】:

    标签: python machine-learning scikit-learn svm


    【解决方案1】:

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

    其实class weightclass_label: value形式的字典。

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

    【讨论】:

      猜你喜欢
      • 2014-10-10
      • 2013-05-23
      • 2020-07-17
      • 2014-08-14
      • 2015-03-12
      • 2014-07-16
      • 2013-10-13
      • 2020-01-01
      • 2020-10-15
      相关资源
      最近更新 更多