An input is a property of a data point that a model can use to make a prediction. These properties are usually called features. In a table, each row is a data point and the feature columns describe it; for a pet, they might include size, name, type, weight, or even pixel colors in an image. section 2.2 section 2.3
A label, also called a target, has a different job: it is the value the model tries to predict from the inputs. For housing, number of rooms can be an input and price the label. A model turns inputs into a prediction, such as a price or a category. section 3.2 section 2.7
Predicting a house price
Suppose nearby houses show that each extra room raises the price. The number of rooms is the input. A simple linear regression model multiplies that input by its weight, adds a bias, and produces a predicted price. Other possible inputs include size, crime rate, age, school quality, and distance to a highway. section 3.2 section 3.37
Inputs can take several useful forms:
- Numerical inputs use numbers, such as age, area, size, weight, price, or income. section 2.7 section 9.7
- Categorical inputs use a finite set of states, such as platform, location, or dog/cat/bird. section 2.7 section 3.27
- Text inputs can use words, such as words in an email; sender and message size can also be inputs for spam detection. section 8.3 section 5.23
Models use inputs in different ways. Linear regression assigns each input a weight. A decision tree chooses an input that best splits the data, then keeps choosing inputs for smaller groups. A numerical input such as age can become yes-or-no questions at different cutoffs. section 3.37 section 9.2 section 9.9
Table 9.3 Our original app recommendation dataset with the platform and (numerical) age of the users. This is the same as table 9.1.
|
Platform
|
Age
|
App
|
|
iPhone
|
15
|
Atom Count
|
|
iPhone
|
25
|
Check Mate Mate
|
|
Android
|
32
|
Beehive Finder
|
|
iPhone
|
35
|
Check Mate Mate
|
|
Android
|
12
|
Atom Count
|
|
Android
|
14
|
Atom Count
|
Compare platform and age inputs in a small recommendation dataset, then see how an age value can be tested with different split points. section 9.9
Choosing and preparing inputs matters. A housing model can use only area or use all available features. Before fitting a model with many inputs, missing values can be removed, numerical columns can be scaled and centered, and categorical columns can be one-hot encoded. Scaling helps prevent larger-valued inputs from dominating training. section 3.27

















