Saturday, March 18, 2017

First Python Machine Learning

This 7 minute youtube video shows how to write your first machine learning program.
from sklearn import tree

features = [[140, 1], [130, 1], [150, 0], [170, 0]]
labels = [0, 0, 1, 1]

clf = tree.DecisionTreeClassifier()
clf = clf.fit(features, labels)

print( clf.predict([[160, 0]]) )

Run with this command:
python hello_machine.py
[1]