IB Computer Science A4.2: Data preprocessing (HL only)
New IB Computer Science syllabus · first exams May 2027 · Theme A · HL only
A model is only as good as its data: "garbage in, garbage out". A4.2 covers how data is cleaned and prepared before training, which features to keep, and why having too many features causes problems.
| Statement | Topic | Command term |
|---|---|---|
| A4.2.1 | Significance of data cleaning | Describe |
| A4.2.2 | Role of feature selection | Describe |
| A4.2.3 | Importance of dimensionality reduction | Describe |
Key points
A4.2.1 Data cleaning
Poor data quality directly lowers model performance and introduces bias. The techniques named in the guide:
- Handle outliers: cap them, remove them, or keep them if they're genuine rare events.
- Remove or merge duplicates.
- Identify incorrect data and filter out irrelevant data.
- Fix badly formatted data: dates, units, inconsistent text.
- Deal with missing data in one of three ways:
- delete the row or column: simple, but loses information
- impute a value, such as the mean, median or mode: keeps the rows, but can distort the data
- predict the missing value from other features: more accurate, but more complex
- Normalization: rescales values to a fixed range, usually 0–1 (min–max).
- Standardization: rescales to a mean of 0 and a standard deviation of 1 (z-score). It's less sensitive to outliers.
A4.2.2 Feature selection
Keep the most informative features and drop the rest. The three strategy types in the guide:
- Filter methods: score each feature with a statistic before training.
- Wrapper methods: test combinations of features by training models.
- Embedded methods: selection happens inside the training algorithm itself.
A4.2.3 Dimensionality reduction
The curse of dimensionality: as the number of features grows, these problems appear:
- overfitting
- higher computational cost
- sparse data
- less meaningful distance measures
- harder visualisation
- a need for more samples
- higher memory use
Reducing the number of variables while keeping the relevant information counters these problems.
Exam-style question
Describe the difference between normalization and standardization, including when each is appropriate. [5]
Mark scheme
Award [1] for each point, up to [5]:
- Normalization rescales values to a fixed range, usually 0–1, using min–max scaling;
- It's appropriate for distance-based algorithms (such as K-NN and k-means) and for neural network inputs;
- Standardization rescales a column to a mean of 0 and a standard deviation of 1 (a z-score);
- It's appropriate when data is roughly normally distributed and for algorithms that expect zero-centred input;
- Standardization is less sensitive to outliers than min–max normalization;
Common mistakes that cost marks
- "Just delete every row with a missing value." This can throw away most of the data, and biases what's left.
- Confusing normalization with standardization. One rescales to a fixed range; the other uses the mean and standard deviation.
- Confusing feature selection with dimensionality reduction. Selection keeps some of the original features; reduction creates fewer new ones.
Frequently asked questions
Is A4.2 on the SL syllabus?
No. The whole of A4.2 is HL only.
Do I need to know PCA?
No. The guide states PCA and LDA are beyond the scope of the course.
Go further
- Practise A4.2 with instant marking on ExamHaus. → examhaus.com
- Full A4.2 presentation and question bank with mark scheme on CS Exam Ready. → csexamready.com/resources/ib-diploma
- IB CS mock exams: Paper 1 & 2, SL & HL. → examhaus.com/mock-exams
