GoalExplain how an AI learns and can be unfair, and work out picture sizes, binary numbers and letter codes.
New words
bias · unfairness in an AI’s results, often caused by training data that leaves some groups outcolour depth · the number of bits stored for each pixel; depth 2 allows 4 coloursvector graphic · a picture stored as a list of shapes, not as pixelsplace value · the value of a position in a binary number: 128, 64, 32, 16, 8, 4, 2 and 1
Explanation
An AI learns patterns from training data, and then it makes guesses about new data. If the training data leaves some things out, the AI is biased and makes more mistakes for them, so a person must check what it decides. An AI system has inputs from sensors, cameras or microphones, a process and an output, and it can predict the future from past data, for example with a mean. Never give personal information to an AI chatbot. A bitmap picture is made of pixels, and its size in bits is the number of pixels across × the number of pixels down × the colour depth. A colour depth of 2 allows four colours and a depth of 3 allows eight. In a binary number each place has a value, and you add the values where there is a 1. Sound is measured by an analogue to digital converter, and each letter is stored as one byte.
Kind of data
How the computer stores it
picture
pixels, each with a binary colour code
sound
readings from an analogue to digital converter, stored as binary numbers
text
one byte (8 bits) for every character
whole number
binary place values 128, 64, 32, 16, 8, 4, 2, 1
Worked examples
Group
Training photos
Test photos
Correct
Percent correct
dogs
90
10
9
90%
cats
10
10
4
40%
A team trains an AI to tell dogs from cats. The training set has 90 dog photos and only 10 cat photos. In the test the AI gets 9 of 10 dogs right but only 4 of 10 cats. The cats were left out of the training data, so the AI is biased. The fix is to add many more varied cat photos and test again.
This hot-air balloon is 9 pixels across and 6 down, with four colours: 00 = blue, 01 = red, 10 = yellow and 11 = brown. The colour depth is 2, so the file needs 9 × 6 × 2 = 108 bits. Eight colours would need a depth of 3, and the same picture would need 9 × 6 × 3 = 162 bits.
128
64
32
16
8
4
2
1
0
0
1
0
1
1
0
1
To read a binary number, add the place values that have a 1. Here 32 + 8 + 4 + 1 = 45. In a character chart each letter has an 8-bit code, and the codes go up by one for each letter. If P is 01010000, which is 64 + 16 = 80, then the code 01010011 is 64 + 16 + 2 + 1 = 83, which is three letters later: S.
Class activity
Bias test with cards (no computer): draw 12 small training cards for a pretend AI that tells dogs from cats: 10 dogs and 2 cats. Draw 6 test cards, 3 dogs and 3 cats. A partner studies only the 12 training cards and then guesses the label of each test card. Count the correct guesses for dogs and for cats and write the percentages. Why are they different? Add 8 more cat cards to the training set, swap partners and test again. Then, on squared paper, colour a 6 × 6 picture with two colours and work out its size in bits.
Practice
1
A smart plant pot has a soil moisture sensor, a pump and a light. Say whether each part is an input, a process or an output.
Part of a smart plant pot
INPUT, PROCESS or OUTPUT?
soil moisture sensor
?
compare the reading with the best level
?
pump starts
?
a light that shows the water tank is empty
?
The soil moisture sensor is an INPUT. Comparing the reading with the best level is the PROCESS. The pump starting is an OUTPUT, and the light that shows the empty tank is an OUTPUT too.
2
A bus company counted the riders on four Mondays. An AI predicts the next Monday from the mean of the past numbers. What does it predict? Give one reason why the real number might be different.
Monday
Riders
1
48
2
52
3
45
4
51
next
?
The sum is 196 and 196 ÷ 4 = 49, so the AI predicts about 49 riders. A holiday, bad weather or a school trip could change the real number, because the AI only knows the past.
3
The code of row 3 is hidden. Write it. How many bits does the whole picture need? How many would it need with a colour depth of 2?
Row 3 has black pixels in columns 2 to 7: 01111110. The picture is 8 across and 6 down, so it needs 8 × 6 × 1 = 48 bits. With a colour depth of 2 it would need 8 × 6 × 2 = 96 bits.
4
(a) Use the chart to decode the message 01010100 01001111 01010000. (b) Change 00110010 into an ordinary number.
Letter
Code
M
01001101
N
01001110
O
01001111
P
01010000
Q
01010001
R
01010010
S
01010011
T
01010100
(a) 01010100 is T, 01001111 is O and 01010000 is P, so the word is TOP. (b) 00110010 = 32 + 16 + 2 = 50.