Last active
July 17, 2017 06:13
-
-
Save saiumesh535/47f864e747062ecff1b1af5c625c92d0 to your computer and use it in GitHub Desktop.
Sklearn Python Example
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
# source https://www.youtube.com/watch?v=cKxRvEZd3Mw | |
from sklearn import tree; | |
# 0 for bumpy | |
# 1 for smooth | |
features = [[140,1], [130,1], [150,0], [170,0]] | |
#0 for apple | |
#1 for orange | |
labels = [0 ,0, 1, 1]; | |
# this is for classifier | |
# for now this is empty box of rules | |
clf = tree.DecisionTreeClassifier(); | |
# fit() helps us in finding patterns in taining data | |
clf = clf.fit(features, labels); | |
# now lets predict the fruit first input is weight and second is bumpty or smooth | |
clf = clf.predict([[143, 1]]); | |
# if you see the output it will give you whether its Apple or Orange | |
print(clf); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment