LinearSVC() differs from SVC(kernel='linear')

前端 未结 1 1533
借酒劲吻你
借酒劲吻你 2021-01-14 00:03

When data is offset (not centered in zero), LinearSVC() and SVC(kernel=\'linear\') are giving awfully different results. (EDIT: the problem might b

相关标签:
1条回答
  • 2021-01-14 00:51

    Reading the documentation, they are using different underlying implementations. LinearSVC is using liblinear where SVC is using libsvm.

    Looking closely at the coefficients and intercept, it seems LinearSVC applies regularization to the intercept where SVC does not.

    By adding intercept_scaling, I was able to obtain the same results to both.

    LinearSVC(loss='hinge', intercept_scaling=1000)
    

    0 讨论(0)
提交回复
热议问题