Shaping data for learning
From the raw table to the matrix an algorithm accepts: individuals and variables, variable types, encoding, scaling and three distances (Euclidean, Manhattan, cosine).
- 26 cards
- 6 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- The numbers
- Scenarios
- Understand
A few cards from the deck
Feature: what is it?
Show the answer
A column of a dataset that describes each individual (a row) by a measurement or a category, and that the model receives as input.
The dataset becomes a matrix: one row per individual, one column per variable. The algorithm only sees numbers, hence encoding and scaling.
A “city” column holds 5 distinct cities. How many columns does one-hot encoding create, without dropping any?
- 5 columns
- 1 column holding the integers 1 to 5
- 4 columns, the last one being deducible from the others
- 10 columns, one per pair of cities
Show the answer
5 columns
One indicator column per level, so 5; each row has a single 1. Dropping a column (4) is an option you choose explicitly, and the integer 1 to 5 is ordinal encoding, wrong for a city.
The … distance adds up the absolute differences, variable by variable, without squaring them.
Show the answer
The Manhattan distance adds up the absolute differences, variable by variable, without squaring them.
Between (2, 5) and (6, 2): |6 − 2| + |2 − 5| = 4 + 3 = 7, compared with 5 for the Euclidean distance. Think of a trip on a street grid, where you cannot cut diagonally.
Quantitative and qualitative variables: what is it?
Show the answer
Quantitative: a measurement on which arithmetic makes sense, continuous if any value in an interval is possible, discrete if it counts whole units. Qualitative: a category, nominal if it has no order, ordinal if the levels can be ranked.
A postcode looks like a number but is nominal: averaging it means nothing. The type decides the encoding and the calculations allowed.