[Numpy-discussion] Maximum-margin linear classifier
Mohan Radhakrishnan
radhakrishnan.mohan at gmail.com
Sun Nov 30 02:36:08 EST 2014
Hi,
I am a beginner.
I have 4 points and wish to plot the classifier separation line. I believe
this code without the plot is correct.
Can I look at sample plotting code(with basic explanation) for this simple
SVM ?
X = [[3,3], [7,2], [5,4], [8,3]]
Y = [-1, -1, 1, 1]
clf = svm.SVC(kernel='linear',C=2)
clf.fit(X,Y)
for i in range(4):
x = np.array(X[i])[0]*clf.coef_[0][0] + np.array(X[i])[1]*clf.coef_[0][1]
+ clf.intercept_;
print x
print clf.intercept_
print clf.coef_
Thanks,
Mohan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141130/7e3c4c7f/attachment.html>
More information about the NumPy-Discussion
mailing list