例如,我们有f(x)= x.如何策划?我们取一些x然后计算y并再次执行此操作,然后逐点绘制图表.简单明了.
但我无法理解如此清晰地绘制决策边界 - 当我们没有绘制时,只有x.
SVM的Python代码:
h = .02 # step size in the mesh
Y = y
# we create an instance of SVM and fit out data. We do not scale our
# data since we want to plot the support vectors
C = 1.0 # SVM regularization parameter
svc = svm.SVC(kernel='linear', C=C).fit(X, Y)
rbf_svc = svm.SVC(kernel='rbf', gamma=0.7, C=C).fit(X, Y)
poly_svc = svm.SVC(kernel='poly', degree=3, C=C).fit(X, Y)
lin_svc = svm.LinearSVC(C=C).fit(X, Y)
# create a mesh to plot in
x_min, …Run Code Online (Sandbox Code Playgroud)