concept slope in category machine learning

appears as: slope, The slope, slope, slopes
Grokking Machine Learning MEAP V09

This is an excerpt from Manning's book Grokking Machine Learning MEAP V09.

The slope of a line is a measure of how steep the line is. It is calculated by dividing the rise over the run (i.e., how many units it goes up, divided by how many units it goes to the right). This is constant over the whole line. In a machine learning model, it tells us how much we expect the value of the label to go up, when we increase the value of the feature by one unit.

The slope simply tells us how steep the line is, and the y-intercept tells us where the line is located. The slope is defined as raise divided by run, and the y-intercept tells us where the line crosses the y-axis (the vertical one). In the Figure 3.6 we can see both of them in an example. This line has the following equation:

y = 0.5 x + 2.
Figure 3.6. The line with equation y = 0.5x + 2 has slope 0.5 (left) and y-intercept 2 (right).

What does this equation mean? It means that the slope is 0.5, and the y-intercept is 2.

The slope being 0.5 means that when we walk along this line, for every unit that we move towards the right, we are moving 0.5 units up. The slope can be zero if we don’t move up at all, or negative if we move down. However, many lines can have the same slope. I can draw a parallel line to this one, and it would also rise 0.5 units for every unit it moves towards the right. This is where the y-intercept comes in. The y-intercept tells us where the line cuts the y-axis. This particular line cuts the line at height 2, so that is the y-intercept.

In other words, the slope of the line tells us the direction that the line is pointing towards, and the y-intercept tells us the location of the line. Notice that by specifying the slope and the y-intercept, the line gets completely specified. Also, think of what would happen if we change the slope and the y-intercept by small amounts. The line would move a little, right? In which directions? We’ll see this next.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage