AI · 3.2
Datasets, Splits and Bias: Good Data In, Good AI Out
Name
Class
Date
Mark / 23
Section A
Circle the letter of the correct answer. One mark each.
- 1What is the test set for?1
- AOne final, honest estimate of how the model performs on unseen data
- BStoring data that has been cleaned
- CLearning the model's parameters
- DChoosing the best settings during development
- 2What is the validation set used for?1
- AGiving the final score that is reported to users
- BLearning the model's parameters from examples
- CChoosing settings and comparing models while building
- DFilling in values that are missing from the data
- 3Which is an example of data leakage?1
- APhotos of the same patient appear in both the training and test sets
- BThe data is shuffled before splitting
- CThe validation set is used to choose settings
- DThe training set is larger than the test set
- 4Why should time series data not be shuffled before splitting?1
- ATime series data cannot be split into different sets
- BThe model would learn from the future to predict the past
- CShuffling makes the test set much too small to be useful
- DShuffling deletes some of the data points in the series
- 51 in 200 emails is a phishing attack. A model never flags anything. What is its accuracy?1
- A0.5%
- B50%
- C99.5%
- D100%
- 6A dataset has a missing age for one student. Which is a sensible fix?1
- ASet it to the largest age in the data
- BFill it with the median age, or drop the row
- CSet it to 0
- DDelete the age column from every row
- 7A face recognition system was trained mostly on photos of lighter-skinned men. Which bias is this?1
- AData leakage
- BMeasurement bias
- CLabel noise
- DSampling bias
- 8A recruiting model learns from ten years of past hiring decisions that favoured men. Which bias is this?1
- ASampling bias
- BClass imbalance
- CLeakage
- DHistorical bias
- 9Why should accuracy be checked for each subgroup of users?1
- AChecking subgroups raises the model's overall accuracy
- BSmaller subgroups always get a higher accuracy than average
- CA good overall score can hide worse results for a small group
- DThe law requires every group to get exactly equal accuracy
- 10What does random.seed(7) do before random.shuffle?1
- AStops the shuffle from changing anything
- BPicks seven random items
- CShuffles the list seven times
- DMakes the shuffle the same every time the program runs
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1ExplainExplain why data is split into training, validation and test sets.4
- 2EvaluateA bank trains a fraud detector on data where 0.5% of transactions are fraud. It reports 99.5% accuracy. Evaluate this claim.5
- 3DescribeDescribe two different ways bias can enter the data used to train an AI system. Give an example of each.4
Mark scheme
Section A
Section B
1 Explain why data is split into training, validation and test sets. 4
One mark for each of the following, to a maximum of 4.
- The model must be judged on data it has not seen
- Training set: learns the parameters
- Validation set: tune settings or compare models
- Test set: used once for an honest final estimate
Model answer. A model has to be judged on data it has never seen, otherwise we only measure how well it memorised. The training set is used to learn the parameters. The validation set is used during development to choose settings and compare models. The test set is kept unseen until the end and used once, so it gives an honest estimate of how the model will perform on new data.
2 A bank trains a fraud detector on data where 0.5% of transactions are fraud. It reports 99.5% accuracy. Evaluate this claim. 5
One mark for each of the following, to a maximum of 5.
- A model that never predicts fraud also scores 99.5%
- So accuracy mostly measures the imbalance
- Recall: how much real fraud is caught
- Precision: how many flagged transactions really are fraud
- A fix: resampling, class weights or more fraud examples
Model answer. The claim is meaningless on its own. Because only 0.5% of transactions are fraud, a model that never predicts fraud at all would also score 99.5% accuracy while catching nothing, so accuracy here mostly measures the imbalance. The bank should report recall, the share of real fraud that is caught, and precision, the share of flagged transactions that really are fraud. The model could also be improved by oversampling fraud cases or weighting mistakes on them more heavily.
3 Describe two different ways bias can enter the data used to train an AI system. Give an example of each. 4
One mark for each of the following, to a maximum of 4.
- A first type of bias named and described
- A valid example of it
- A second, different type named and described
- A valid example of the second
Model answer. Sampling bias happens when the data does not represent the people the system will be used on. For example, face analysis systems trained mostly on lighter-skinned faces were found in 2018 to misclassify darker-skinned women far more often. Historical bias happens when data accurately records an unfair past. For example, a recruiting tool trained on ten years of mostly male CVs learned to mark down CVs containing the word women's.