Class 8 · Unit 4: Data and fairness · Lesson 4.2 · 40 min
Finding bias in a dataset
“I knew it was unfair,” says Rahat. “Knowing isn't showing,” says Hiba. One formula later: Delicious 214, Ambri 9.
Today you will: Count who's in a dataset · Compare the data's share with the world's · Find the gap in languages too
Story
In Class 7, Rahat's uncle's leaf app failed on his Ambri trees. This year the class has the app company's own training list: 300 rows, each naming the variety, the district and the light the photo was taken in.
Rahat: “I knew it was unfair.”
Hiba: “Knowing isn't showing.” (She sorts the sheet, types one formula, and reads the answer aloud.)
Delicious: 214 photos. Ambri: 9.
Rahat stares. "Nine."
Hiba: “Now you can tell them. Not 'it feels unfair'. Nine out of three hundred.”
Watch
Counting, not arguing — — scan code 8.4.2 in the printed book.
Learn it
In Class 7 you named three kinds of bias. In Class 8 you measure one of them. Saying "it feels unfair" can be brushed aside; saying "9 photos out of 300" cannot. Count how much of a dataset each group makes up, then compare that with how common the group is in the real world where the tool will be used. A big difference is a gap, and a warning to test that group on purpose.
Words to know
- Audit a careful count and check of what is in a dataset.
- Representation a group's share of the dataset: its count ÷ the total × 100.
- Real-world share how common the group is where the tool will actually be used.
- Gap a big difference between the share in the data and the share in the world.
- Under-represented a group with far less data than its real-world share.
- Low-resource language a language with little recorded or written data for training, like Kashmiri. It is a fact about the data, never about the speakers.
Step by step: auditing a dataset of 200 photos
| Variety | Photos | Share of data | Share of orchards [example] |
|---|---|---|---|
| Delicious | 150 | 150 ÷ 200 = 75% | 40% |
| American | 40 | 20% | 25% |
| Ambri | 10 | 5% | 35% |
- Decide which groups to count: here, apple varieties.
- Count each group: in Calc,
=COUNTIF(B2:B201;"Ambri"). - Turn counts into percentages: count ÷ 200 × 100.
- Compare with the real world: Ambri is 5% of the data but about 35% of these orchards. That is the biggest gap.
- Test that group on purpose: a gap is a warning, not proof of harm. Next, test the model on Ambri leaves.
The same count works for languages: hours of recorded speech per language, against the number of speakers. Kashmiri has many speakers and little data.
Careful: equal numbers for every group is not always the goal. The target is usually each group's share of the world the tool will serve. And a percentage does not prove harm: it shows you where to test. Lesson 4.3 does the testing.
On the laptop
You need: LibreOffice Calc · dataset-audit.ods (300 rows: photo id · variety · district · light · camera) · language-data.ods (illustrative)
Part A: Count the groups (8 min, in pairs)
Mission 1: Your mission
- ☐1
Save a copy with your names. List the varieties: Delicious, Ambri, American, Maharaji.
- ☐2
Predict: what share will Ambri have? Then count each:
=COUNTIF($B$2:$B$301;E2)and a percentage:=F2/300*100. - ☐3
Do the same for district and light.
Part B: Chart the gap (8 min)
- ☐4
Bar chart of the variety shares, titled "Share of the training data".
- ☐5
Add the real share of Kashmir's orchards your teacher gives you, and chart the two together. Finish: "The biggest gap is ___: ___% of the data and about ___% of the orchards."
Part C: The same test, on languages (4 min)
- ☐6
Sort
language-data.odsby hours of data. Where is Kashmiri? "A tool trained on this would work best for ___ and worst for ___."
No laptop today?
Tally a printed 60-row extract by hand, work out the percentages, draw the bar chart on squared paper, and write the gap sentence.
Debate it
The company could answer: "We used the photos we could get. Nobody sent us Ambri leaves."
Is that a fair answer? Whose job is it to go and collect the missing data — and who should pay for it?
Check yourself — practice, not a test
1. What does representation mean when auditing a dataset?
- ○ How pretty the chart looks
- ○ What share of the dataset each group makes up
- ○ How accurate the model is overall
- ○ How many people use the app
2. A language with very little recorded or written data available for training is called a ______ language.
3. Finding that a group has only 3% of the rows proves the model will harm that group.
- ○ True
- ○ False
4. Put an audit in the right order:
- 1. Test the model on the under-represented group
- 2. Turn the counts into percentages
- 3. Compare with the real-world share
- 4. Count the rows in each group
- 5. Decide which groups to count
5. Which comparisons help show a gap? (choose all that apply)
- ○ Share of photos of each variety vs. share of orchards planted with it
- ○ Hours of speech data per language vs. number of speakers
- ○ The file size of the dataset vs. the laptop's memory
- ○ Photos taken in sunshine vs. photos taken in shade, where both are common
Remember
Measure first. "Nine out of three hundred" is an argument. "It feels unfair" is not.
Typing practice
Skill: numbers and formula symbols at speed (Term 2 focus, 6 min)
- On typing.com, do one number-row or symbol lesson.
- Then type this line three times in Calc's input bar without looking down:
=COUNTIF(B2:B301;"Ambri")/300*100