本章部分代码来自https://www.jb51.net/article/131580.htm
from sklearn import svm
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
x = np.r_[np.random.randn(20,2)-[2,2],np.random.randn(20,2)+[2,2]] #正态分布来产生数字,20行2列*2
y = [0]*20+[1]*20 #20个class0,20个class1
clf = svm.SVC(kernel='linear')
clf.fit(x,y)
w = clf.coef_[0] #获取w
a = -w[0]/w[1] #斜率
#画图划线
xx = np.linspace(-5,5)<