-
-
Save amankharwal/5bbb58f658b2ff4966beb33f10e921e8 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 | |
from sklearn.datasets import load_iris | |
from sklearn.linear_model import Perceptron | |
iris = load_iris() | |
x = iris.data[:,(2,3)] #petal length, petal width | |
y = (iris.target == 0).astype(np.int) #iris setosa | |
perceptron = Perceptron() | |
perceptron.fit(x, y) | |
ypred = perceptron.predict([[2, 0.5]]) | |
print(ypred) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment