Maximum-margin linear classifier
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
Hi Mohan,
While you might get responses here, you'll probably have better luck asking
on the scikit-learn list. (I assume you are using scikit-learn for the
svm?) That's where you'll find experts on the details of these models
hanging out - this is the list for numpy itself, and numpy doesn't include
svms or plotting support directly. (StackOverflow is also sometimes a good
place to try for general questions that aren't really specific to any one
project.)
Good luck!
-n
On 30 Nov 2014 07:36, "Mohan Radhakrishnan"
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
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Mohan Radhakrishnan
-
Nathaniel Smith