Skip to content

Instantly share code, notes, and snippets.

@romain130492
Last active April 7, 2020 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romain130492/4846d3e86be420c0d49266cdccb83304 to your computer and use it in GitHub Desktop.
Save romain130492/4846d3e86be420c0d49266cdccb83304 to your computer and use it in GitHub Desktop.
#Ml : sklearn- Prediction with #Python 3

Ml : sklearn

Prediction

from sklearn import tree


#height, weight, shoe size
X= [[181,80,44], [177,70,43],[160,60,38],[154,754,437],[166,65,40],
[190,90,47],[175,64,39],[177,70,40],[159,64,39],[171,75,42],[181,85,43]]

Y=['male','female','female','female','male','male','male','female','male','female','male']

clf = tree.DecisionTreeClassifier()

clf = clf.fit(X,Y)

prediction = clf.predict([[160,70,39]])

print(prediction)
# Print => ['female']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment