12.1. THE MACHINE-LEARNING MODEL
465
Beagles
Weight
Height
Chihuahuas
Dachshunds
height = 7
weight = 3
Figure 12.1: Repeat of Fig. 7.1, indicating the heights and weights of certain
dogs
An appropriate way to implement the decision function f would be to imag-
ine two lines, shown dashed in Fig. 12.1. The horizontal line represents a height
of 7 inches and separates Beagles from Chihuahuas and Dachshunds. The verti-
cal line represents a weight of 3 pounds and separates Chihuahuas from Beagles
and Dachshunds. The algorithm that implements f is:
if (height > 7) print Beagle
else if (weight < 3) print Chihuahua
else print Dachshund;
Recall that the original intent of Fig. 7.1 was to cluster points without
knowing which variety of dog they represented. That is, the label associated
with a given height-weight vector was not available. Here, we are performing
supervised learning with the same data augmented by classiﬁcations for the
training data.
✷
Example 12.2 : As an example of supervised learning, the four points (1, 2),
(2, 1), (3, 4), and (4, 3) from Fig.11.1 (repeated here as Fig. 12.2), can be thought
of as a training set, where the vectors are one-dimensional. That is, the point
(1, 2) can be thought of as a pair ([1], 2), where [1] is the one-dimensional feature
vector x, and 2 is the associated label y; the other points can be interpreted
similarly.
Suppose we want to “learn” the best model for the full set of points, from
which these four points are taken as examples. A simple form of model, the one
we shall consider, is a linear function f(x) = ax + b. A natural interpretation
