Chapter 2
Your First Learning Program

Welcome to our first stepping stone in machine learning. In this chapter, we’re going to build a tiny supervised learning program. It will be a long haul from this program to our goal of image recognition—in fact, at first it won’t have anything to do with computer vision at all. However, we’ll improve its code over the next chapters, until it gets sophisticated enough to tackle images.

We’ll base the first version of our program on a technique called linear regression. Remember what I said in the previous chapter? Supervised learning is about approximating data with a function. In linear regression, that function is as simple as it could be: a straight line.

However simple linear regression is, don’t underestimate the challenge ahead. To introduce linear regression, this chapter will touch on many different concepts—so many that you might feel slightly overwhelmed. Take it slow and easy. Even if it looks like we’re just writing a short program, we’re actually laying the foundation of our ML knowledge. What you learn here will stay useful throughout this book, and beyond. Let’s start with a practical problem.