Skip to content

Instantly share code, notes, and snippets.

@aswinmohanme
Last active December 18, 2016 14:27
Show Gist options
  • Select an option

  • Save aswinmohanme/bed667b90bb36edc9928e977522f8b63 to your computer and use it in GitHub Desktop.

Select an option

Save aswinmohanme/bed667b90bb36edc9928e977522f8b63 to your computer and use it in GitHub Desktop.
#Import the Algorythm
from sklearn.neighbors import KNeighborsClassifier
# Instantiate the Classifier
knn = KNeighborsClassifier()
# Train the Model
knn.fit(X,y)
# Create some test data , this corresponds with 0 species
test_data = [5.0 , 3.1,1.4,0.2]
# Predict using the trained Model
prediction = knn.predict([test_data])
print(prediction)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment