How would you have a machine recognize a cat?

Wednesday, May 16, 2018

I wrote my first computer program in college. It was, surprisingly, not “Hello World”, but typing the number “6” into a Scheme interpreter prompt. You can see how Scheme responded below.

> 6
6

This may seem uninspiring but it was the first time I spoke to a computer, using a language we both could commonly understand. In fact, even though I was dutifully copying examples from my textbook, I distinctly remember feeling like I was having a conversation with my computer. I believe this feeling belies the core of what programming is: communicating and delegating to a machine.

At the time, I thought what needed to be communicated was a precise set of instructions on how I wanted the machine to complete a task. And before I could write the instructions, I had to thoroughly understand how I would personally complete the task. It was only then that I could tell a machine how to complete it. After all, machines were drones, they didn’t have their own minds, they just followed orders. Machines were an extension of myself, just with greater calculating power over a shorter time frame.

Fast forward to today, some things are changing.

I still write plenty of programs that specifically codify exactly how I want a machine to complete a task. To be frank it’s quite belittling toward machines. Imagine you walked into work every morning to your boss handing you a many paged document describing exactly how they want your day to go.

You are to write up a presentation with exactly 12 slides, don’t use Google Docs use that new software we just bought that you hate, if Steve from Sales walks by your cubicle and wants to talk about fantasy football you are to ignore him, oh and make sure you clock out exactly at 5PM because the company doesn’t want to pay any more overtime.

It’d be a nightmare to work for such a boss, I’m certain I’d quit within the first week. We all want to work with a boss that’s better at delegating tasks, one that lets us exercise our creativity on how to best complete a task without assuming we are incompetent. Why don’t we give machines a similar courtesy?

Of course, we still need to provide clear and exact instructions to machines. But instead of telling them how to complete a task, we can tell them how to approach a task.

We need to reach our quarterly profit goals. Here is a manual describing the experiments we ran in past quarters and how our profit changed. Figure out what to do with the data from our current quarter. And I’ll be honest with you, I have no idea what need to do to reach this goal, but I know you are efficient and calculating, I believe in you.

This approach to programming is machine learning in a nutshell (specifically supervised learning). The programmer can push the responsibility of domain knowledge to the machine, and instead focus on providing tools (data) and instructions on how to use these tools. This is a powerful idea because it means we’ll be able to leverage machines to accomplish tasks we don’t have the resources/training to do ourselves.

My first machine learning program was a cat classifier (this is the “Hello World” equivalent for machine learning). Essentially the program receives possible cat images and, using nothing but the RGB values of each pixel of it image, the program decides whether the photo contains a cat. It ended up having an 80% success rate on a test data set I used. Now, while it’s true that I could probably get at least a 99% success rate in classifying cat photos (accounting for some misclicks), I’m certain any explicit program I might write would operate at much worse than 80% accuracy. I wouldn’t even know where to start. A cat has pointy ears, but what are pointy ears, in fact, how do I describe what an ear looks like? How are pointy cat ears different from pointy mouse ears? Imagine having to describe what a cat looks like to a baby. You’d probably end up pointing out cats in real life until the baby learned itself through recognizing the patterns, a remarkably similar strategy to how we implement machine learning :).

Now, you might be wondering how exactly a machine learns without a human explicitly teaching it how to do the task. Stick around, that’ll be the topic of an upcoming post :).

[machine-learning] [deep-learning]