Data transformation: normalisation, discretisation, sampling and compression
GATE DA150 min read
Data preprocessing turns raw records into data that analysis and learning can use. It has four classic stages:
- cleaning: missing values, noise and outliers;
- integration: merging sources and removing redundancy;
- transformation: normalisation, discretisation and encoding;
- reduction: sampling, dimensionality reduction and compression.
Exam point. "Normalisation" here means rescaling attribute values. It is unrelated to database normal forms (1NF, 2NF, …).
Normalisation (feature scaling)
Algorithms that use distances (k-NN, k-means, SVM) or gradient descent are distorted when attributes have very different ranges. Rescaling fixes this.
Running data: 200, 300, 400, 600, 1000.
Min–max normalisation
- To : gives 0, 0.125, 0.25, 0.5, 1.
- To , the value 600 becomes .
Facts.
- It keeps the order and the relative distances.
- A single outlier squeezes all the other values together.
- New data outside the old range maps outside .
z-score standardisation
- The mean is , and the deviations are .
- The population variance is , so .
- So 1000 becomes , and 200 becomes .
The result has mean 0 and SD 1. It suits roughly normal data and handles outliers better than min–max. A robust variant uses the median and the IQR instead.
Decimal scaling
, with the smallest integer such that . Here , so , and the values become 0.02, 0.03, 0.04, 0.06 and 0.1.
Other transforms
- Log transform tames right-skewed data such as incomes or counts.
- Unit-length scaling is used for text vectors, before cosine similarity.
Exam trap. Compute the scaling parameters (min, max, mean, SD) on the training data only, then apply the same parameters to the test data. Computing them on all the data leaks information.
Discretisation (binning)
Discretisation turns a continuous attribute into intervals or categories. It reduces noise and is needed by some algorithms, such as basic ID3 and naive Bayes on counts. It also makes rules easier to read.
Running data (sorted): 5, 7, 8, 12, 15, 18, 20, 22, 23, 30, 31, 35.
Equal-width binning
Split the range into intervals of equal width . With , :
- : {5, 7, 8, 12}
- : {15, 18, 20, 22, 23}
- : {30, 31, 35}
It is simple, but skewed data leaves some bins nearly empty, and outliers waste bins.
Equal-frequency (equal-depth) binning
Put the same number of values in each bin. With 3 bins of 4:
- {5, 7, 8, 12}
- {15, 18, 20, 22}
- {23, 30, 31, 35}
You have read the free 27% of this note
Sign in with Google to keep reading. It is free, takes one tap, and you also get:
- 7 practice questions from this note
- Every note in full, plus the PDF library
- Official past papers as timed tests, with explanations
- An AI tutor for doubts, in Hindi or English
- Your progress, mistakes and study plan saved on every device