AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Smart rules, extra layers

Week 28 · 4.5 Augmented reality and AI · 3 lessons
1

Rules or learning?

Computing 8: Topic 4.5, pp. 283–299
GoalExplain what AI is, and tell preprogrammed rules apart from machine learning.
New words
artificial intelligence (AI) · a computer system that imitates human intelligencepreprogrammed rules · rules written by a programmer that never change by themselvesmachine learning · when an AI system learns from many examples and changes its own rules
Explanation

Artificial intelligence, or AI, is a computer system that imitates human intelligence, for example by recognising pictures, understanding speech or choosing a move. Some AI systems follow preprogrammed rules. A programmer writes the rules, and the computer follows them exactly. It does not learn anything new, so it can only answer what its rules cover. Other systems use machine learning. They are shown a very large number of examples and they find patterns in them. They then change their own rules as they learn, and they improve with more examples. So machine learning is one kind of AI, and an AI system that only follows fixed rules does not learn.

Preprogrammed rulesMachine learning
Who makes the rules?the programmerthe system, from examples
Do the rules change?only if a programmer changes themyes, as it learns
Handles new things?only what the rules covercan cope with new examples, but may be wrong
Worked examples
Python
1question = input("Ask: ")
2if question == "hours":
3    print("Open 9 to 5")
4elif question == "address":
5    print("12 Example Road")
6else:
7    print("Sorry, I do not know")
Output
Sorry, I do not know
A library helper answers by fixed rules, written as if / elif / else. It can answer “hours” and “address”. For any other question, such as parking, it only says sorry, however many times it is asked. It follows preprogrammed rules. It does not learn.
TypedThe program prints
hoursOpen 9 to 5
HoursSorry, I do not know
The same program gives a different answer for “Hours” with a capital H, because strings are case-sensitive. The program is not learning from its mistake. A programmer must edit the rules.
A fruit-sorting camera is shown 5,000 photos labelled ripe or not ripe. It works out which patterns go with ripe fruit, such as colour and softness marks. Nobody wrote “if yellow, then ripe”. This is machine learning. If it makes mistakes, more examples can improve it.
Class activity

Rules versus learning (no computer). Play “Rule robot”. One person is a robot with exactly four written rules (for example: “if you hear clap, jump”; “if you hear snap, spin”; “if you hear stamp, sit”; else “say sorry”). The others give commands. Does the robot ever invent a new rule? Then play “Learning robot”: the robot is not given rules, but shown ten examples of “good” and “bad” answers by a partner (for example, shown ten pictures of shapes called “yes” or “no”) and must guess a new picture. Discuss which robot can cope with something new, and which can be wrong. If you have a computer or tablet, ask an adult to help you run the pool helper program and try five questions.

Practice
1
A pool’s helper program is typed “towels”, then “Towels”. What does it print each time? Explain.
Python
1question = input("Ask: ")
2if question == "pool":
3    print("Open 7 to 9")
4elif question == "towels":
5    print("Hire at the desk")
6else:
7    print("Sorry, I do not know")
2
Is the library helper machine learning? Give one reason.
3
A system is trained on thousands of voice recordings, and it gets better at understanding words. Is this preprogrammed rules or machine learning? Explain.
4
Fill each gap with AI or machine learning: every ____ system is also an ____ system, but an ____ system that only follows fixed rules does not learn.