gpt4 book ai didi

python - scikit 中的 SVC 与 LinearSVC 学习 : difference of loss function

转载 作者:行者123 更新时间:2023-12-03 13:37:31 26 4
gpt4 key购买 nike

根据 this post ,scikit learn中的SVC和LinearSVC有很大的不同。但是在阅读 official scikit learn documentation 时,不是很清楚。
特别是对于损失函数,似乎有一个等价:
enter image description here
this post说 le 损失函数是不同的:

  • SVC : 1/2||w||^2 + C SUM xi_i
  • 线性SVC:1/2||[w b]||^2 + C SUM xi_i

  • 似乎在 LinearSVC 的情况下,截距是正则化的,但官方文档另有说明。
    有人有更多信息吗?谢谢

    最佳答案

    SVCLIBSVM 的包装器图书馆,而 LinearSVCLIBLINEAR 的包装器LinearSVC一般更快 SVC并且可以处理更大的数据集,但它只能使用线性内核,因此得名。所以区别不在于制定,而在于实现方法。
    报价LIBLINEAR FAQ :

    When to use LIBLINEAR but not LIBSVM

    There are some large data for which with/without nonlinear mappings gives similar performances.
    Without using kernels, one can quickly train a much larger set via a linear classifier.
    Document classification is one such application.
    In the following example (20,242 instances and 47,236 features; available on LIBSVM data sets),
    the cross-validation time is significantly reduced by using LIBLINEAR:

    % time libsvm-2.85/svm-train -c 4 -t 0 -e 0.1 -m 800 -v 5 rcv1_train.binary
    Cross Validation Accuracy = 96.8136%
    345.569s

    % time liblinear-1.21/train -c 4 -e 0.1 -v 5 rcv1_train.binary
    Cross Validation Accuracy = 97.0161%
    2.944s

    Warning:While LIBLINEAR's default solver is very fast for document classification, it may be slow in other situations. See Appendix C of our SVM guide about using other solvers in LIBLINEAR.
    Warning:If you are a beginner and your data sets are not large, you should consider LIBSVM first.

    关于python - scikit 中的 SVC 与 LinearSVC 学习 : difference of loss function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64257876/

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