Data as a Matrix: Rows, Features and the Target
Almost every method takes the same shape of input: one row per example, one column per feature, and a separate target column. Getting real data into that shape means encoding categories, scaling columns onto comparable ranges, and deciding what one row is.
What a learner can do afterwards
- Turn a table with text categories into a numeric feature matrix
- Say why scaling matters when features are measured in different units
- Decide what one row should represent for a stated prediction question
1 · Read
Almost every method expects one grid: one row per example, one column per feature, plus a separate target column. The box where a row meets a column is a cell with a single value. For house sales you might use rooms, area, and neighborhood as features with price as the target.
Models only multiply and add numbers, so words must become numbers first. Turn each neighborhood into its own 0 or 1 flag, with 1 marking a match. A table with 4 text columns and 3 numeric ones needs 4 columns encoded, while the numbers stay as they are.
Features must live on comparable ranges, or the biggest numbers decide everything. Income spans thousands while schooling spans single digits, so raw gaps in income drown schooling out of every distance. Rescale each column before you train.
Let the question pick the row: to predict popcorn buys, make one row one person visit with a yes or no attached. Keep labels like seat numbers and IDs out of the features. In a diagnosis table you would also drop a treatment given after diagnosis, keeping the illness status apart as the target.
One row per example, numbers only, comparable ranges, and the target kept apart is the shape every model wants.
2 · Watch
Take it off screen
Where it sits
8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.