الأسبوع 5 · الدرس ٢ «خوارزميات الذكاء الاصطناعي» (٢): البحث والترتيب وتعلم الآلة والتعلم العميق والفرق عن الخوارزميات التقليدية · 3 دروس
2
Machine learning: learning from examples
ICT Prep 3 Term 1, Unit 1, Lesson 2: pp. 22–30
GoalExplain how a machine learns from labelled examples and say why its answers can be wrong.
New words
machine learning · a way for computers to learn a rule from examples instead of being given the ruletraining data · the examples used to teach a modellabel · the right answer attached to an examplespam · unwanted messages, often advertising or tricks
Explanation
How does a small child learn the difference between an apple and an orange? Nobody gives the child a rule; the child sees many fruits and hears their names. Machine learning works in a similar way. We give the computer many examples with their labels, the right answers, and the computer finds the pattern by itself. For spam, the examples are messages labelled spam or normal. After training, the model can label a new message, but it only makes a good guess, and it can be wrong, especially if the training data was small or one-sided. A fixed rule such as: if the message contains the word free, call it spam, is not machine learning, because a person wrote the rule and nothing was learned. Language models are trained on very large amounts of text and can write answers that sound natural, but they can be wrong too.
A
B
1
Message
Label
2
win a prize now
spam
3
lunch at one
normal
4
free gift, click here
spam
5
homework is due Monday
normal
Worked examples
Salma shows a young cousin many pictures: red apples, green apples and oranges, each with its name. Soon the cousin names a new picture correctly, even a yellow apple. Nobody gave a rule about colours.
labelled examples→computer finds a pattern→a rule is learned→new message gets a label
The steps of machine learning: labelled examples go in, the computer finds a pattern, the pattern becomes a rule, and the rule labels a new message. The new label is a guess, so a person checks important results.
Class activity
Invent six short messages, three that look like spam and three that look normal, and write the label next to each. Then write one new message and say what label a trained model might give it, and why it could be wrong.
Practice
1
What is a label?
The right answer attached to an example, such as spam or normal.
2
What does a computer receive in machine learning: the rule or the examples?
The examples, with labels. It finds the rule itself.
3
Why can a trained spam model make a mistake?
Its answer is a guess from patterns; the training data may be small or one-sided.
4
Is the rule “if the message has the word free, it is spam” machine learning?
No. A person wrote the rule; nothing was learned from examples.