# Feature Engineering

> How raw data becomes inputs a model can use. Make new features, one-hot encode the words, and put the numbers on one scale.

**Course:** [Machine Learning](https://learn.benibix.com/learn/ai-machine-learning)  
**Time:** 12 min

**After this lesson you can:**

- Make a useful feature from raw data
- One-hot encode a column of words
- Explain why number columns need scaling

## How raw data becomes something a model can use

Feature engineering is making better inputs from raw data, so a model learns more easily. A date can become 'day of the week'. Price and size can become 'price per square metre'. On table data, a good new feature often helps more than a fancier model. It puts the clue the model needs into one column.

Most models only read numbers, so words have to be turned into numbers first. Calling London 1, Paris 2 and Tokyo 3 looks fine. But it tells the model that Tokyo is three times London. That order is false, and the model will use it anyway.

One-hot encoding fixes this. Each city gets its own column. A London house has a 1 in the London column and a 0 in the others. Now no city is bigger than another. The cost is width: a column with 500 different values becomes 500 columns.

Feature scaling puts number columns on a similar range. Age runs from 0 to 100, while income can reach 200,000. Some models judge rows by how far apart they are, and then the big column drowns out the small one. Scaling both to run from 0 to 1 gives each a fair say.

There are two common ways. Min-max scaling squeezes each column to between 0 and 1. Standardization shifts each column so its average is 0 and most values sit close to it. Tree models need neither. Models that measure distance, or that learn in small steps, usually do.

Scaling has a trap of its own. Work out the ranges from the training set only, then apply them to the test set. If the test rows help set the ranges, a little of the test data has leaked into training, and the score will flatter the model.

Deep learning finds many features by itself, which is why photos and sound need far less of this work. On tables of numbers and words, though, this is still where most of the gains come from. People often reach for a bigger model first, when a better column would do more.

![One raw row, with the city Paris, 50 square metres and a price of 600, becomes a ready row. The city turns into three one-hot columns for London, Paris and Tokyo reading 0, 1 and 0. A new feature, price per square metre, reads 12. The price is scaled to 0.67 on a 0 to 1 range, and a label, sold fast, is added by a person.](https://learn.benibix.com/diagrams/ai3-data-prep.svg)

### Example: Lucy adds a weekend column

Lucy's shop data has the time of each order, down to the second. Her sales model guesses busy days poorly.

She adds one column: weekend or not. That single feature cuts her model's daily miss from 40 orders to 15.

**Words in this lesson:** [Feature Engineering](https://learn.benibix.com/term/ai/feature-engineering), [One-Hot Encoding](https://learn.benibix.com/term/ai/one-hot-encoding), [Feature Scaling](https://learn.benibix.com/term/ai/feature-scaling)

**Question:** Why not code London, Paris and Tokyo as 1, 2 and 3?

**Answer:** It tells the model the cities have a size order they do not have. Numbers carry an order, so 3 reads as three times 1. One-hot encoding gives each city its own column, so none is bigger than another.

---

Source: https://learn.benibix.com/learn/ai-machine-learning/feature-engineering
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
