Tuesday, November 29, 2016

Google Developers Six Lines of Code To Understand High Level Machine Learning


What I like about this video by Google Developers is that it takes just six minutes to show the high level programming points of machine learning.  Admittedly, if you do not have a programming background, it moves rather quickly and makes assumptions on understanding simple programming concepts.

Under Anaconda, I found there was a bug in his last line of code and I added the last two lines to fix it so it runs:
 

from sklearn import tree
features = [[140, 1], [130, 0], [150, 0], [170, 0]]
labels = [0, 0, 1, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features,labels)
result = clf.predict([[160, 0]])
print(result)


The description at YouTube states:

"Six lines of Python is all it takes to write your first machine learning program! In this episode, we'll briefly introduce what machine learning is and why it's important. Then, we'll follow a recipe for supervised learning (a technique to create a classifier from examples) and code it up."


There is a rebirth of AI with machine learning and during my break from work life, machine learning is one of the areas I will be exploring through hands-on programming.  As my grandfather Melvin Thompson once said, "you don't learn how to milk a cow by reading a book." :-)  True, but reading some books first on machine learning and then programming might be a reasonable path...