Quick Summary of a Basic AI Project

Learn to code AI




July 27, 2018

Let’s get into our very first AI project. Everyone starts right here and works their way up.

Everyone seems to associate Artificial Intelligence with robots taking over the world. Honestly, this couldn’t be further from the truth. Artificial Intelligence is simply the practice of humans exploiting a computers superhuman ability to reason logically.

When you were in High School, at some point your parents probably punished you for staying out too late. Then you probably did it a few more times before finally realizing, "maybe I should just listen to them."

The AI program gets grounded thousands of times in seconds! Over and over again, the machine is reinforced what it should, and shouldn't do. And the beauty is it doesn’t get argue back. Toughness builds character as they say.

So let’s dive right in. We’re going to make a program that takes an image of a flower, and predicts with 99% accuracy the type of flower that it is. Fairly irrelevant, but change flower to burglar and you can imagine the practical application. 

In a nutshell, you're literally just taking a bunch of pictures of flowers (thousands), defining common characteristics of all the flowers, and then training your machine (computer program) over and over again to figure out how to recognize a picture of a flower that it's never seen before. Doesn't sound so scary anymore does it?

So given a database of flowers (Google Iris dataset), and the flower features (columns labeled Sepal Length, Sepal Width, Petal Length, Petal Width) the machine has to figure out a pattern that works across the board. The better the pattern, the higher the accuracy rate, and the more you're able to "predict the future." If you aren’t a flower person – just go with it.

It’s like saying “big nose, small ears, no eyelashes, great teeth” – Oh you must be a…." except that would be generalizing and fairly insulting. Take it a step further though, and you have gene classification.

Anyway, you take this huge database of flowers classified by 4 categories and you say “Hey machine, all of these flowers are either Setosa, Versicolor, or Virginica, find me some sort of pattern in the Sepals or Petals using the algorithm I gave you to see if you can figure out a picture you haven't seen before.” 

The algorithm used in this project is called a decision tree algorithm. Imagine if you were a monkey and had to crawl down every single possibility of branches on a tree, even the little ones. The choices would be overwhelming. Well computers are particularly apt tree climbers. Problem solved.

It’s just a bunch of if and else conditions put together to figure out how to differentiate all the flowers.

After you train the machine, you give him (or her) a few pictures that s/he hasn’t viewed yet, and check the results.

And that’s literally it. Put in any image of a flower, and see what flower is actually is. Would make Mother’s Day easier wouldn’t it!

If you understand what’s going on, then the coding part is like learning how to speak another language. It's not easy, but it's a fairly straightforward process. But on the other hand if you don’t know how to play checkers, it doesn’t matter if you opponent is speaking Parseltongue.

We’re going to post a comprehensive step by step article on the coding side of this problem, including the libraries you’ll need etc.

Think about this... for every choice you make, there's a choice (or many choices) that you did not make. How different would your life be if you shuffled all those choices? Imagine though that you could cycle through all of these decision combinations and choose the most optimal path. "Darn,  I wish I hadn't been pulled over by the cops when I was 20." That's pretty much where AI is taking us.