A Table Is Not Yet A Learning Problem
A Titanic table contains age, passenger class, ticket, fare, cabin, port, and survival. A beginner may treat every column as “just data.” But averaging ticket numbers is meaningless, class is ordered but not a physical measurement, and survival can be either a descriptive column or the target of a prediction task.
A data type describes what operations and assumptions are valid—not merely how a value is stored.
Retrieval Warm-Up
- What is fixed during inference but adjusted during training?
- What is the difference between a prediction and a label?
- Why can training accuracy fail to measure generalisation?
One concrete dataset
| PassengerId | Pclass | Sex | Age | Fare | Embarked | Survived |
|---|---|---|---|---|---|---|
| 1 | 3 | male | 22 | 7.25 | S | 0 |
| 2 | 1 | female | 38 | 71.28 | C | 1 |
| 6 | 3 | male | missing | 8.46 | Q | 0 |
Each row is an observation/sample/instance. For survival prediction, Pclass through Embarked may be features, Survived is the label, and PassengerId is an identifier.
Column-Type Explorer
Click a column
Numerical
A measured quantity; differences and averages are meaningful.
Types Determine Valid Transformations
| Type | Example | Meaning for modelling |
|---|---|---|
| Numerical | Age: 38, fare: 71.28 | Arithmetic, order, distances; check units and skew. |
| Categorical | Embarked: C, Q, S | Names/groups without order; encode deliberately. |
| Ordinal | Cabin class: 1st, 2nd, 3rd | Ordered categories, but gaps are not equal. |
| Text | Passenger name or review | Variable length; tokens and meaning require representation. |
| Time series | Timestamped daily demand | Order, lags, trend, seasonality; random shuffle may leak future. |
| Image | Passenger photograph | Pixel grid with spatial channels and resolution. |
| Boolean | Survived: yes/no | Two-state category, often a label. |
| Identifier | PassengerId, ticket number | Locates records; usually not a meaningful numeric quantity. |
Features, Labels, Metadata, And Leakage
Available input used to predict, such as age at boarding.
Observed answer, such as survived.
Joins records but should not imply magnitude.
Context for slicing or auditing; may or may not be used by the model.
Information unavailable at prediction time, such as a rescue record.
Unknown/unrecorded—not automatically zero.
Train, Validation, And Test
Training set: adjusts parameters. Validation set: compares modelling decisions. Test set: estimates final performance after choices are frozen.
Split before learning imputations, vocabularies, or scaling constants. For time series, train on the past and test on the future. For related passengers or repeated entities, grouped splitting may prevent near-duplicates crossing boundaries.
Inspect Before Transforming
import pandas as pd
df = pd.read_csv("notebook/data/titanic.csv")
print(df.shape) # (891, 12)
print(df.dtypes) # storage types, not full semantic types
print(df.isna().sum()) # Age 177, Cabin 687, Embarked 2
print(df.nunique())
roles = {
"PassengerId": "identifier",
"Pclass": "ordinal feature",
"Sex": "categorical feature",
"Age": "numerical feature",
"Survived": "binary label",
}Worked Classification
A column stores values 1, 2, 3 for cabin class.
It is physically stored as an integer, semantically ordinal, and should not automatically be treated as a continuous measurement. A ticket number contains digits but is an identifier/categorical token, not a quantity.
Mastery Check
1. Classify age, port, class, review, timestamp, image, ticket, and survival.
2. Why is missing age not age zero?
3. Give a leakage feature for survival prediction.
4. Explain the three data splits and when each may influence decisions.
5. Tomorrow retrieve all data types; in three days classify a new schema cold.
Next: What Kind Of Feedback Exists?
Now that examples, features, and labels are concrete, we can classify learning problems by what signal the learner receives.