liveBook · Manning

Input

As explained in Grokking Machine Learning

A property or characteristic of a data example that a model can use to make predictions.

What clues would help you decide whether an email is spam? Its size, the day it arrived, and the words it contains could all help. Each such property is a feature: a characteristic of a data example that a model can use to make a prediction. A model might use one feature or combine several. section 1.3 section 8.2

In a table, each row usually represents one example and each feature occupies a column. The label is what you want to predict from the other columns. For a pet, type could be the label when predicting cat or dog; age could instead be the label when predicting age. A feature's role therefore depends on the question. section 2.1

Predict a house price from one feature

Suppose nearby houses cost $150 with one room, $200 with two, and $250 with three. The pattern adds $50 per room to a $100 base price: predicted price = 100 + 50 × number of rooms. For a four-room house, the prediction is $300. Here, room count is the input feature and price is the label. A fuller model could use size, location, and other properties too. section 3.2 section 3.1

Table 3.1 A table of houses with the number of rooms and prices. House 4 is the one whose price we are trying to infer. (view table figure)

Number of rooms

Price

1

150

2

200

3

250

4

?

5

350

6

400

7

450

Compare the room counts and prices, then try filling in the missing price before using the formula. section 3.2

Features need not be numbers at first. Age and fare are numerical; categories such as gender or boarding location are categorical. One-hot encoding turns categories into numerical columns, while binning can turn an age into a range. Feature selection removes columns judged unnecessary. These choices shape the inputs the model receives. section 13.3 section 13.7

Different models use features differently. A decision tree can ask whether a user is below an age cutoff and compare that split with one based on phone platform. A spam model can use the presence of words to estimate the probability of spam. After preparing a dataset, separate its features from its labels, then use training, validation, and test data to assess predictions. Try choosing a label in a small table and asking which remaining columns might help predict it. section 9.2 section 9.3 section 13.4

How Grokking Machine Learning covers it

How deep it goes
Defines features as table columns, works through a weighted house-price input, and develops categorical and numerical preprocessing.
Examples
Uses email size and words, pet properties, house room counts, and passenger columns as concrete inputs.
What it assumes
Introduces features through familiar emails and tables before using formulas, without requiring prior machine-learning terminology.
What you can do after
Apply it via Pandas and Scikit-Learn to prepare feature columns, separate them from labels, and train and evaluate models.
How it connects
Links features to labels, linear regression, decision trees, one-hot encoding, and feature selection.

Also explained in

Compare how 14 books explain input →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.