Lensa ML
Lensa ML

Feature Extraction

How raw data becomes the language of machine learning

Step 1 of 6

Data Starts Messy

Before ML can learn, it needs structured numbers — rows and columns of measurements

A dataset of 8 houses — each row is one observation
Sq FtBedsAge (yr)Dist (mi)PoolPrice ($k)14002358.2No$215k2200453.1Yes$485k18003155.5No$340k3100521.8Yes$710k95015012No$145k2600484.2Yes$560k12002289.5No$190k16503206.8No$285k
8
Samples
5
Input Features
1
Target

Every ML model starts with a table of data. Each row is one example (a house). Each column is a feature — a measurable property. The last column is the target — what we want to predict. Feature extraction is about making these columns as useful as possible.

Step 1 of 6: Data Starts Messy

Before ML can learn, it needs structured numbers — rows and columns of measurements

A dataset of 8 houses — each row is one observation
Sq FtBedsAge (yr)Dist (mi)PoolPrice ($k)14002358.2No$215k2200453.1Yes$485k18003155.5No$340k3100521.8Yes$710k95015012No$145k2600484.2Yes$560k12002289.5No$190k16503206.8No$285k
8
Samples
5
Input Features
1
Target

Every ML model starts with a table of data. Each row is one example (a house). Each column is a feature — a measurable property. The last column is the target — what we want to predict. Feature extraction is about making these columns as useful as possible.

Step 2 of 6: Features Are the Vocabulary

Each column is a feature — one measurable property the model uses to make predictions

1400H12200H21800H33100H4950H52600H61200H71650H8μ=1862.5
950
Min
1862.5
Mean
3100
Max
2150.0
Range

A feature is a single measurable property — one column in your data. Numerical features like square footage have magnitude and spread. Categorical features like "pool" encode discrete groups. Understanding each feature's distribution is the first step to deciding how to transform it.

Step 3 of 6: Craft Better Signals

Transform raw columns into features that expose hidden patterns to the model

Formula: price ÷ sqft
215k ÷ 1400=154485k ÷ 2200=220340k ÷ 1800=189710k ÷ 3100=229145k ÷ 950=153560k ÷ 2600=215190k ÷ 1200=158285k ÷ 1650=173Source ValuesNew FeatureDistribution

Price per Sq Ft: Normalizes price by size — a 3000 sqft house costing $600k is cheaper per foot than a 1000 sqft house at $300k. Feature engineering is the art of creating new columns from existing ones that make patterns easier for the model to see. Good features often encode domain knowledge — things you know about the problem that raw numbers don't capture.

Step 4 of 6: Put Features on Equal Footing

Normalize values so no single feature dominates by sheer magnitude

Sq Ft95031001400220018003100950260012001650Age2503551525082820Dist2128362124107
Sq Ft ranges 950–3100 while Beds is 1–5 — the model thinks Sq Ft is 600× more important!

Feature scaling prevents features with large magnitudes from dominating. Min-Max squeezes values into [0, 1]. Z-Score standardization centers at zero with unit standard deviation. Most algorithms — gradient descent, KNN, SVM — need scaled features to work properly.

Step 5 of 6: Compress Without Losing Meaning

Project high-dimensional data into fewer dimensions that capture the most variance

Sq Ft (z)Age (z)H1H2H3H4H5H6H7H8
2D
Original
Project
1D
Reduced

PCA finds the axis of maximum variance — the direction along which data spreads the most. It then projects every point onto that line. Here, PC1 captures 80% of the information from 2 features in just 1 number. In real ML, PCA can compress hundreds of features into a handful of principal components.

Step 6 of 6: Keep Only What Matters

Measure each feature's predictive power and discard the noise

Sq Ft42%Age24%Pool16%Distance11%Beds7%Threshold: 15%
Threshold15%
3
Kept
2
Dropped

Feature importance scores rank how much each feature contributes to predictions. Features below the threshold add noise without signal. Dropping them gives a simpler model that generalizes better — fewer features means less overfitting, faster training, and easier interpretation.