Lesson 11.2 · 8 min read · about 50 min to master at a very slow pace
Designing a Network for Tabular Data
A worked design for a regression problem: predicting house prices from features such as size, bedrooms and location. Architecture, activations, loss, regularisation, categorical features and the challenges to expect.
The task
Predict a house's price (a number) from features: floor area, number of bedrooms, location, property type, and so on. This is regression on tabular data.
A sensible starting design
| Choice | Proposal | Why |
|---|---|---|
| Layers | 2–3 fully connected hidden layers, e.g. 64 → 32 → 16 units | Tabular features have no spatial structure, so dense layers suit; shrinking widths compress the features |
| Hidden activation | ReLU | Non-linear, cheap, avoids vanishing gradients |
| Output | 1 unit, linear | A price is any positive real number; a sigmoid would cap it |
| Loss | MSE (MAE if outliers matter) | Standard for regression; MAE resists extreme prices |
| Regularisation | L2 weight decay; optionally dropout; early stopping | Tabular datasets are often small, so overfitting is the main risk |
It's a starting point, not a recipe: the best architecture depends on the data and is chosen on validation performance.
Preparing the features
- Numeric features: standardise using training statistics (also the target, then undo it on the predictions).
- Categorical features (location, property type): one-hot encode. With many categories (hundreds of postcodes), use an embedding layer that learns a short dense vector per category.
- Missing values: impute with training medians and add "was missing" indicators.
- Outliers: cap or remove clear errors; consider a log of the price as the target.
Challenges to expect
- Overfitting on a small dataset: regularise, use cross-validation, collect more data.
- Mixed feature types and scales: encode and scale consistently.
- Irrelevant features: L1 or simply checking which features matter.
- Leakage: a feature known only after the sale (such as the final agent fee) must be excluded.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
First passWhy not encode location as a number, like 1 = north, 2 = south?
Because the network would treat it as a quantity: "south" would be "twice north", and locations 1 and 3 would look further apart than 1 and 2. One-hot encoding gives each location its own input with no false ordering; embeddings go further and learn which locations behave similarly.
Cheatsheet
Tabular regression design
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.