Created
April 16, 2016 18:16
-
-
Save alejandrofloresm/8721d3af5e944c6462b0ece61e67e9b3 to your computer and use it in GitHub Desktop.
Hello World for Google
This file contains hidden or 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
# Code example for: | |
# Hello World - Machine Learning Recipes #1 - Google Developers | |
# https://www.youtube.com/watch?v=cKxRvEZd3Mw | |
from sklearn import tree | |
# Bumpy = 0, Smooth = 1 | |
features = [[140, 1], [130, 1], [150, 0], [170, 0]] | |
# Apple = 0, Orange = 1 | |
labels = [0, 0, 1, 1] | |
clf = tree.DecisionTreeClassifier() | |
clf = clf.fit(features, labels) | |
print clf.predict([[160, 0]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent work, Now change the above code to handle the following input:
x represents the feature training rows. y represents the labels. Do this, and I'll guide you again.