A machine learning model does not see your business. It sees numbers in columns, and it learns only from what those columns say. Feature engineering is how you decide what the model gets to see.
This guide explains feature engineering techniques in plain language: the types, the steps in order, and a worked example on five Bengaluru flat listings, with every output checked in Python.
Quick answer: What are feature engineering techniques? Feature engineering techniques are methods that turn raw data into inputs a machine learning model can learn from. The main ones are filling missing values, encoding categories, creating new features, scaling, binning and feature selection. Well-built features give a model clearer patterns to learn from.
What Is Feature Engineering in Machine Learning?
The feature engineering definition most sources agree on is simple. IBM calls it “the process of transforming raw data into relevant information for use by machine learning models.”
A feature is one input column, such as a flat’s area or locality. Put simply, the feature engineering definition is this: improve those columns by cleaning them, converting them and creating new ones. That is feature engineering in machine learning.
Data preprocessing and feature engineering overlap, but the goal differs. Preprocessing makes data usable, like removing blanks. Feature engineering makes it informative, like turning a date into a month. Both sit inside the machine learning life cycle.
Types of Feature Engineering and How to Do It
These are the types of feature engineering techniques in machine learning you will meet in most projects. Each row is one step, in the order to follow.
| Step | Type | What it does | Example technique |
|---|---|---|---|
| 1 | Cleaning | Fixes blanks and bad values | Median fill |
| 2 | Encoding | Turns categories into numbers | One-hot encoding |
| 3 | Creation | Builds new columns from old ones | Ratios, date parts |
| 4 | Scaling | Puts numbers on a similar scale | Z-score, min-max, log |
| 5 | Binning | Groups numbers into ranges | Age bands |
| 6 | Selection | Keeps only useful columns | SelectKBest, RFE |
This is how to do feature engineering without redoing work: follow these feature engineering steps top to bottom. Create new features before you scale. Scale first and then divide one column by another, and you get a ratio nobody can read. Numbers and categories also need different handling, so check your data types first.
Feature Engineering Examples using Five Bengaluru Flats
These feature engineering methods run on five fictional flats, so the numbers are for learning, not market advice. The goal is to predict price from raw columns.
| Flat | Area (sq ft) | BHK | Locality | Age (years) | Listed on | Price (lakh) |
|---|---|---|---|---|---|---|
| 1 | 650 | 1 | HSR Layout | 3 | 14 Mar 2026 | 85 |
| 2 | 1,200 | 2 | Whitefield | 8 | 2 Jun 2026 | 95 |
| 3 | 900 | 2 | HSR Layout | blank | 20 Jun 2026 | 130 |
| 4 | 1,500 | 3 | Whitefield | 12 | 5 Sep 2026 | 110 |
| 5 | 1,800 | 3 | Koramangala | 5 | 1 Nov 2026 | 300 |
Step 1: Fill the missing value
Flat 3 has no age. The other four ages are 3, 5, 8 and 12, so the median is 6.5. Fill the blank with 6.5. A median is safer than a mean when a few values are extreme.
Step 2: Encode locality with one-hot encoding
Google’s ML course says “Machine learning models can only manipulate floating-point numbers.” So “HSR Layout” must become numbers. One-hot encoding gives each locality its own 0 or 1 column. Flat 1 becomes HSR Layout = 1, Koramangala = 0, Whitefield = 0. Flat 2 becomes 0, 0, 1.
Step 3: Create new features
- Area per BHK: area divided by BHK gives 650, 600, 450, 500 and 600. Flat 3 has just 450 sq ft per bedroom, a signal the raw columns hid.
- Date parts: 14 Mar 2026 becomes month 3, and a Saturday.
Step 4: Scale the numbers
Area runs from 650 to 1,800 while BHK runs from 1 to 3. Google’s ML course says “The goal of normalization is to transform features to be on a similar scale.”
- Z-score: mean area is 1,210 and standard deviation is 410.4. Flat 1 becomes -1.36 and flat 5 becomes 1.44.
- Min-max: squeezes area into 0 to 1. Flat 2 becomes 0.48.
- Log: ln(area) turns 650 into 6.48 and 1,800 into 7.50, which shrinks big gaps.
Step 5: Bin the age
Google says binning is a good alternative when “the overall linear relationship between the feature and the label is weak or nonexistent.” Use three bands: new (up to 5 years), mid (6 to 10) and old (over 10). Ages 3, 8, 6.5, 12 and 5 become new, mid, mid, old, new.
Here are the same feature engineering examples in code:
df[“age”] = df[“age_years”].fillna(df[“age_years”].median())
df = df.join(pd.get_dummies(df[“locality”]))
df[“area_per_bhk”] = df[“area_sqft”] / df[“bhk”]
df[“area_z”] = StandardScaler().fit_transform(df[[“area_sqft”]])
df[“age_band”] = pd.cut(df[“age”], [0, 5, 10, 100], labels=[“new”, “mid”, “old”])
Advanced Feature Engineering Techniques
Beyond the basic feature engineering methods, advanced feature engineering adds two ideas: features that combine columns, and features that shrink many columns into few. These two advanced feature engineering techniques are worth learning first.
- Polynomial features: scikit-learn says polynomial features can “get features’ high-order and interaction terms.” On area and BHK, flat 1 becomes 650, 1, 422,500 (area squared), 650 (area times BHK) and 1. Flat 2 becomes 1,200, 2, 1,440,000, 2,400 and 4.
- Feature extraction: IBM describes it as “creating a new dimensional space for a model.” PCA is a common example. The catch is that new columns are hard to explain to a business manager.
What are Feature Selection Techniques?
Scikit-learn says “Feature selection is usually used as a pre-processing step before doing the actual learning.” These feature selection techniques are the four to know:
| Method | What it does |
|---|---|
| VarianceThreshold | Removes features whose variance is below a threshold |
| SelectKBest | Keeps only the k highest scoring features |
| RFE | Drops the least important features, round after round |
| SelectFromModel | Removes features a trained model finds unimportant |
Common Feature Engineering Mistakes
Even correct feature engineering techniques fail when you make these mistakes:
- Scaling before splitting. Fit the scaler on training data only, as the scikit-learn docs do with StandardScaler().fit(X_train).
- Building features from the target. Price per sq ft predicts price because it contains price. This is target leakage.
- Encoding hundreds of categories. One-hot encoding adds one column per value.
- Never testing the new feature. Compare model scores with and without it.
Conclusion
A model learns only from the columns you give it. These feature engineering techniques turn raw columns into usable inputs, if you apply them in order: clean, encode, create, scale, bin, select. That is how to do feature engineering on any dataset. Take one public dataset this week, run all six feature engineering steps and compare model scores before and after.
If you want guided practice, the Advanced Diploma in Data Science and AI ML at Win in Life Academy covers Python, Pandas and Scikit-learn, with feature engineering in its statistics module, an IBM add-on and 1:1 placement mentorship. For tools, see our guide to the top Python libraries for machine learning.
Frequently Asked Questions About Feature Engineering
1. What is the difference between feature selection and feature extraction?
Feature selection keeps a subset of your existing columns and drops the rest. Feature extraction builds new columns from the old ones, such as PCA components. Selection keeps each column’s original meaning, while extraction usually does not.
2. Do I need to code to learn feature engineering?
Yes, basic Python helps most. Feature engineering techniques in machine learning run mostly in code: pandas handles cleaning and new columns, and scikit-learn handles encoding, scaling and selection. You can practice the logic in a spreadsheet first.
3. How many features should a model use?
There is no fixed number. Start with columns that make business sense, then use feature selection techniques to drop the ones that add nothing. Keep a feature only if scores on unseen data hold or improve.
4. What is the difference between data preprocessing and feature engineering?
Data preprocessing and feature engineering overlap. Preprocessing makes raw data usable by fixing blanks, duplicates and formats. Feature engineering makes it informative by creating, converting and selecting columns that help the model. Most projects need both.
Sources
- IBM, What is feature engineering: https://www.ibm.com/think/topics/feature-engineering
- Google ML Crash Course, Normalization: https://developers.google.com/machine-learning/crash-course/numerical-data/normalization
- Google ML Crash Course, Binning: https://developers.google.com/machine-learning/crash-course/numerical-data/binning
- Google ML Crash Course, One-hot encoding: https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding
- scikit-learn, Preprocessing data: https://scikit-learn.org/stable/modules/preprocessing.html
- scikit-learn, Feature selection: https://scikit-learn.org/stable/modules/feature_selection.html







