Last active
April 3, 2019 05:54
-
-
Save nithyadurai87/2de5a6a6f7cc03c2791305f5c33d43d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn import svm | |
from sklearn.linear_model.logistic import LogisticRegression | |
def classifier(): | |
xx = np.linspace(1,10) | |
yy = -regressor.coef_[0][0] / regressor.coef_[0][1] * xx - regressor.intercept_[0] / regressor.coef_[0][1] | |
plt.plot(xx, yy) | |
plt.scatter(x1,x2) | |
plt.show() | |
x1 = [2,6,3,9,4,10] | |
x2 = [3,9,3,10,2,13] | |
X = np.array([[2,3],[6,9],[3,3],[9,10],[4,2],[10,13]]) | |
y = [0,1,0,1,0,1] | |
regressor = LogisticRegression() | |
regressor.fit(X,y) | |
classifier() | |
regressor = svm.SVC(kernel='linear',C = 1.0) | |
regressor.fit(X,y) | |
classifier() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment