1, the expression of the decision-making function
- Formula:
in which:
2, SVM after training, the resulting "dual_coef_"
- In fact, "dual_coef_" is "ai * yi" collection, namely:
3. Verify
- Linear SVM model used here to verify
from sklearn import svm
from Orange.data import Table
import numpy as np
data = Table("iris2")
model = svm.SVC(C=1.0, kernel='linear')
model.fit(data.X, data.Y)
print(model.dual_coef_)
print(model.support_vectors_)
# 计算法向量 累加(a[i]*y[i]*sv[i]) dual_coef = 累加(a[i]y[i])
x = np.dot(model.dual_coef_ , model.support_vectors_)
print(x[0])
print(model.coef_[0])
model.dual_coef_:
model.support_vectors_:
x[0]
model.coef_[0]: