代码之家  ›  专栏  ›  技术社区  ›  Amutheezan

当使用3个类时,输出对于在Scikitlearn的支持向量机中获取决策函数意味着什么

  •  1
  • Amutheezan  · 技术社区  · 8 年前

    https://prateekvjoshi.com/2015/12/15/how-to-compute-confidence-measure-for-svm-classifiers/

    import numpy as np
    from sklearn.svm import SVC
    x = np.array([[1,2],[2,3],[3,4],[1,4],[1,5],[2,4],[2,6]])
    y = np.array([0,1,-1,-1,1,1,0])
    classifier = SVC(kernel='linear')
    classifier.fit(x,y)
    classifier.decision_function([2,1])
    

    最后一个调用给出大小为3的数组的以下输出

    array([[ -8.88178420e-16,  -1.40000000e+00,  -1.00000000e+00]])
    

    1 回复  |  直到 8 年前
        1
  •  1
  •   Gambit1614    8 年前

    它是点的距离 [2,1] 从分离第一类的超平面,等等。您可以看到函数的实现 here here

    编辑 this example