📘 CodingMarble Learn

Artificial Intelligence: How Machines Learn to Think

Artificial intelligence (AI) is the skill of a computer system to do tasks that normally need human thinking: seeing, understanding speech, deciding and learning. An AI system is an agent that senses, thinks and acts. Old AI followed rules written by people. Modern AI mostly uses machine learning: it finds its own rule from many labelled examples (data). Neural networks are layers of simple units whose link strengths (weights) change during training. AI is used in maps, translation, health, farming and games. It can be wrong or unfair when its data is one-sided (bias), so people must check it, protect privacy and stay responsible.

🎬 Step-by-step story

  1. An AI system is an agent. It senses the world, thinks, and then acts.
  2. Machine learning starts with data: many examples that people have already labelled.
  3. Learning means finding a rule from the data. The wall moves until it makes the fewest mistakes.
  4. A neural network passes numbers through layers. Training changes the strength of each link.
  5. Bias: one-sided data teaches a one-sided rule. Fair, varied data matters.
  6. Free play: move a new fruit and let the AI vote using its nearest neighbours.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Does AI really think like a human?

No. It follows a loop of sensing, computing and acting. Its "thinking" is maths on numbers, not feelings or understanding.

Where does an AI get its knowledge?

From data: many examples labelled by people or collected from the world.

Who writes the rule in machine learning?

Nobody types it. The training process moves the rule (the wall) until mistakes are fewest.

What is a "weight" in a neural network?

A number on each link that says how strongly one unit affects the next; training changes it.

Why can AI be unfair?

If most examples are of one kind, the learned rule favours that kind.

Why does changing k change the answer?

With a bigger k more neighbours vote, so a far-away group can outvote the closest one.

What is artificial intelligence?

Artificial intelligence (AI) means a computer system that can do jobs that usually need a human mind. For example: recognise a face, understand speech, translate a language, play chess or suggest a video.

What counts as intelligent behaviour? A system that can:

Cognitive computing is AI that tries to copy parts of human thinking: it understands language, finds patterns in huge data, gives answers with a level of confidence and keeps learning from feedback.

Narrow AI and general AI

Every AI today is narrow AI: it is good at one kind of task (like spotting spam) but cannot do everything a person can. General AI, a machine as flexible as a human in every task, does not exist yet.

Intelligent agents: sense, think, act

An agent is anything that senses its surroundings and acts on them. A robot is an agent with a body: its sensors (camera, touch, distance) are its senses and its actuators (motors, wheels, arms) are its muscles. The program in the middle decides what to do.

A robot vacuum cleaner is a good example: it senses a wall, decides to turn, and turns. With the Internet of Things (IoT), many small sensors (in homes, farms and factories) send data to an AI that decides, for example, when to water a field.

The loop never stops: the action changes the world, and the agent senses the new situation again.

How AI works: rules, data and machine learning

There are two main ways to make a machine smart.

  1. Rule-based AI (expert systems): people write the rules. "IF temperature > 38 °C THEN fever." Easy to explain, but people cannot write rules for everything (try writing rules for "is this a cat?").
  2. Machine learning (ML): we give the computer many labelled examples (data) and it finds the rule itself. This finding is called training. Then it uses the rule on new cases: this is prediction.

Three kinds of machine learning

How AI makes a judgement

A simple method is k-nearest neighbours: to label a new item, look at the k most similar known items and take a majority vote. The maths behind this is distance (how far apart two points are). Other AI uses probability (how likely each answer is), statistics (averages and patterns) and functions (a rule turning inputs into an output). An AI answer is usually a best guess with a confidence, not a certainty.

Neural networks and deep learning

A neural network is loosely inspired by the brain. It has an input layer (numbers such as pixel brightness), one or more hidden layers of simple units, and an output layer (the answer). Each link has a weight: a number saying how strongly one unit affects the next.

During training the network makes a guess, checks the error, and nudges every weight a little to reduce the error. Repeat this millions of times and the network becomes good at the task. Networks with many hidden layers are called deep learning. Large language models, which chat and write text, are very big neural networks trained on huge amounts of text.

A short history of AI

The maths grew alongside: logic (Boole, 1850s), probability (Bayes, 1700s), statistics, and calculus for adjusting weights.

Where AI is used

Ethics, bias and AI in society

Try it: be the machine

Take 10 fruits or pictures of fruits. Give each a score for softness (1–5) and colour (1–5), and write "ripe" or "unripe". Now take one new fruit, score it, and find the 3 known fruits whose scores are closest. Take a vote. You just did k-nearest neighbours by hand. In the 3D free-play step, do the same with the sliders and check your answer.

Key formulas and definitions

Worked examples

1. A spam filter learns from 10,000 emails that people marked "spam" or "not spam". Which type of machine learning is this?

Supervised learning, because every training example comes with the correct label.

2. Known fruits (softness, colour): A(1, 1) unripe, B(2, 1) unripe, C(4, 4) ripe, D(5, 4) ripe, E(4, 5) ripe. Use 3-nearest neighbours to label a new fruit N(3, 3).

Distances from N: A = √(4+4) ≈ 2.83; B = √(1+4) ≈ 2.24; C = √(1+1) ≈ 1.41; D = √(4+1) ≈ 2.24; E = √(1+4) ≈ 2.24. Nearest is C (ripe), then a tie of B, D and E at 2.24. Taking C, D, E gives 3 ripe votes; taking C, B, D gives 2 ripe to 1 unripe. Either way the vote is ripe.

3. An AI tested on 200 X-rays gets 184 right. What is its accuracy?

Accuracy = 184 ÷ 200 × 100% = 92%.

4. A robot lawn-mower bumps into a flower bed, stops and turns left. Name its sensor, the "think" part and its actuator.

Sensor: bump or distance sensor. Think: the program decides "obstacle → turn". Actuator: the wheel motors that turn it.

Common mistakes

Practice quiz

1. Which task needs AI rather than a simple fixed program?
2. In supervised learning the training data has…
3. Who proposed a test of whether a machine can pass as a human in a chat?
4. What changes inside a neural network during training?
5. An AI trained mostly on photos of adults does badly on children. This is an example of…

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is artificial intelligence in simple words?

It is a computer system that can do things that usually need a human mind, like seeing, understanding speech, deciding and learning from examples.

What is the difference between AI and machine learning?

AI is the big goal of making machines smart. Machine learning is one way to reach it: the machine learns a rule from data instead of being given the rule.

Who is called the father of artificial intelligence?

John McCarthy, who named the field in 1956, is often called its father; Alan Turing's 1950 ideas came before.

Where this is taught

NetherlandsVWO 3 (onderbouw)Data, AI and society
NetherlandsHAVO 5 (eindexamenjaar)Elective theme: Cognitive computing
NetherlandsVWO 6 (eindexamenjaar)Elective theme: Cognitive computing
RomaniaClasa a IX-aDigital society
Spain2º ESOComputational thinking, programming and robotics
Spain3º ESOComputational thinking, programming and robotics
Spain2º BachilleratoEmerging computer systems
Ukraine8 класProblem solving
Ukraine9 класProblem solving
CBSE (India)Class 11AI for Everyone
USA (Common Core, NGSS, AP)Grade 11Algorithms and Programming
South Korea중학교 2학년Artificial intelligence
South Korea중학교 2학년Sustainable technology and convergence
South Korea고등학교 1학년Science and the future
South Korea고등학교 2학년AI and intelligent reasoning
South Korea고등학교 2학년AI and big data
South Korea고등학교 2학년AI and mathematical inquiry
South Korea고등학교 2학년Artificial intelligence
South Korea고등학교 2학년Understanding robots
South Korea고등학교 3학년AI and mathematics
Germany (Bavaria)Jahrgangsstufe 13Artificial intelligence
FranceTerminaleA history of life
China九年级(初三)Module: AI and smart society
China高一Comp.1 Ch.4 Intelligent era
China高三Sel.4 Introduction to AI

Learn first

Learn next

Related lessons

All Computer Science lessons