python svm 决策方程_无法理解SVM和LR中决策边界的绘制

例如,我们有f(x)=x。如何绘制它?我们取一些x,然后计算y,再做这个运算,然后用点绘制图表。简单明了。在

但我无法理解如此清楚地绘制决策边界-当我们没有y来绘制时,只有x

支持向量机的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, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1

y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1

xx, yy = np.meshgrid(np.arange(x_min, x_max, h),

np.arange(y_min, y_max, h))

for i, clf in enumerate((svc, rbf_svc, poly_svc, lin_svc)):

# Plot the decision boundary. For that, we will asign a color to each

# point in the mesh [x_min, m_max]x[y_min, y_max].

所有的图表都在这里,我是怎么理解的:

^{pr2}$

有人能用语言解释一下这个阴谋是如何运作的吗?在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值