A4.3.8 · Machine learning approaches (HL only)
A4.3.8 · 机器学习方法(仅 HL)
Artificial Neural Networks
人工神经网络
Loosely modelled on the brain's own web of neurons, an artificial neural network is layers of simple nodes, each doing nothing more than a weighted sum and a small decision, that together can learn far more complex patterns than any one node could alone.
人工神经网络大致模仿大脑自身的神经元网络,由一层层简单的节点组成,每个节点做的不过是一次加权求和和一个小小的判断,但它们合在一起,能学到比任何单个节点复杂得多的模式。
The command term here is "outline": this statement needs the structure and mechanism stated clearly, not a full mathematical derivation of training.
这里的命令词是"outline(概述)":本条考纲要求清楚说明结构和机制,而不是对训练过程做完整的数学推导。
Explainer
讲解
Layers, weights, biases
层、权重、偏置
An ANN (artificial neural network) is built from an input layer, one or more hidden layers, and an output layer. Each node in a hidden or output layer multiplies each incoming value by a weight, sums them, adds a bias, and passes the result through an activation function before sending it on.
人工神经网络(ANN)由一个输入层、一个或多个隐藏层和一个输出层组成。隐藏层或输出层中的每个节点把每个传入的值乘以一个权重,把它们求和,加上一个偏置,再把结果送入一个激活函数,然后才继续往后传。
| Activation function | What it does | Typical use |
|---|---|---|
| Sigmoid | Squashes any input to a value between 0 and 1 | Output layer of a binary classifier, read as a probability |
| ReLU | Outputs the input directly if positive, otherwise 0 | Hidden layers; fast and avoids some training problems |
| Tanh | Squashes any input to a value between −1 and 1 | Hidden layers where a zero-centred output helps |
| Linear | Passes the input through unchanged | Output layer of a regression network (predicting a number) |
| 激活函数 | 它做什么 | 典型用途 |
|---|---|---|
| Sigmoid | 把任意输入压缩到 0 到 1 之间的一个值 | 二分类器的输出层,读作一个概率 |
| ReLU | 输入为正时直接输出,否则输出 0 | 隐藏层;速度快,并能避免一些训练问题 |
| Tanh | 把任意输入压缩到 −1 到 1 之间的一个值 | 需要零中心化输出有帮助的隐藏层 |
| 线性 | 原样传递输入,不做变换 | 回归网络(预测一个数值)的输出层 |
Explainer
讲解
Forward and back propagation
前向传播与反向传播
Forward propagation is the input working its way forward: values enter at the input layer, pass through whichever hidden layers sit in between, and arrive at the output layer as a prediction. Back propagation is training: the error between the prediction and the true answer is calculated, then worked backward through the network to adjust every weight and bias slightly, so the next prediction is a little closer. One full pass through the entire training set is called an epoch; training repeats over many epochs.
前向传播是数据从输入层出发,经过隐藏层,流到输出层,产生一个预测。反向传播是训练过程:计算预测与真实答案之间的误差,然后把它反向传回网络,对每一个权重和偏置做微小调整,使下一次预测更接近正确答案一点。完整遍历一次整个训练集称为一个轮次(epoch);训练要经过许多轮次反复进行。
Try it yourself
动手试试
A greenhouse fan network
一个温室风扇网络
A tiny trained network decides whether to turn on a greenhouse cooling fan, from two inputs: temperature (0–1, scaled) and humidity (0–1, scaled). Drag the sliders and watch the forward pass, using fixed, already-trained weights and biases, decide the output.
一个微型的、已经训练好的网络,根据两个输入决定是否打开温室降温风扇:温度(0–1,已缩放)和湿度(0–1,已缩放)。拖动滑块,看看前向传播如何用固定的、已经训练好的权重和偏置来决定输出。
H1 has learned to weigh temperature heavily; H2 weighs humidity heavily. The output node combines both hidden nodes, so the fan can be triggered by high temperature alone, high humidity alone, or a combination of both being moderately high.
H1 学到了主要看重温度;H2 学到了主要看重湿度。输出节点把两个隐藏节点的结果结合起来,所以风扇既可能因为温度单独很高而启动,也可能因为湿度单独很高而启动,或者因为两者都适度偏高而启动。
Check your understanding
检验你的理解
What is the role of a bias term in a node of a neural network?
神经网络中一个节点的偏置项起什么作用?
Common mistake
常见错误
RecurringCalling the connection between two nodes "a weight". The link (connection) is the pathway itself; the weight is the number attached to that link, which scales the signal travelling along it. Two different links can carry two very different weights, or a link's weight can be zero (effectively no connection), so the link and its weight are not the same thing.
反复出现把两个节点之间的连接称为"一个权重"。连接(链接)是路径本身;权重是附着在这条连接上的数字,用来缩放沿着它传递的信号。两条不同的连接可以带有两个截然不同的权重,某条连接的权重甚至可以是 0(实际上等于没有连接),所以连接和它的权重不是同一回事。
Wrong: "Each node is joined to the next layer by a weight, which carries the signal forward."
错误: "每个节点通过一个权重连接到下一层,权重把信号往前传递。"
Right: "Each node is joined to the next layer by a link (connection). Every link has its own weight, a number that scales how strongly the signal travelling along that specific link influences the receiving node."
正确: "每个节点通过一条连接连到下一层。每条连接都有自己的权重,一个数字,用来缩放沿着这条特定连接传递的信号对接收节点的影响强度。"
Revision questions
复习题
Specimen-paper style. Write an answer, then reveal the marking points and mark yourself.
采用样卷风格。写下答案,然后展开评分要点给自己打分。
[3]Outline the three layers of a typical artificial neural network.
[3]概述典型人工神经网络的三种层。
Marking points
评分要点
- Input layer: where the raw data first enters the network.
- Hidden layer(s): process the inputs and pass results onward; do not touch the input or output directly.
- Output layer: produces the network's final result.
- 输入层:接收初始数据。
- 隐藏层:处理输入并把结果向后传递;不直接接触输入或输出。
- 输出层:产生网络的最终结果。
[2]Distinguish between a weight and a bias in a neural network node.
[2]区分神经网络节点中的权重和偏置。
Marking points
评分要点
- A weight scales the strength of one specific incoming signal.
- A bias is an extra, constant input (not tied to a real feature) that shifts the node's output, letting it be non-zero even when every real input is zero.
- 权重缩放某一条特定传入信号的强度。
- 偏置是一个额外的、恒定的输入(不对应任何真实特征),用来移动节点的输出,使其在所有真实输入都为 0 时仍能非零。
[4]Outline what happens during forward propagation and during back propagation.
[4]概述前向传播和反向传播期间各自发生了什么。
Marking points
评分要点
- Forward propagation: data moves from input through hidden layer(s) to the output layer, producing a prediction.
- Back propagation: the error between the prediction and the true value is calculated.
- That error is worked backward through the network to adjust every weight and bias.
- 前向传播:数据从输入经过隐藏层流到输出层,产生一个预测。
- 反向传播:计算预测值与真实值之间的误差。
- 把这个误差反向传回网络,调整每一个权重和偏置。
[2]State an activation function suited to the output layer of a regression network, and one suited to a binary classifier.
[2]说出一种适合回归网络输出层的激活函数,以及一种适合二分类器的激活函数。
Marking points
评分要点
- Regression output: linear activation (passes the value through unchanged, allowing any real number).
- Binary classifier output: sigmoid (squashes to 0-1, read as a probability).
- 回归输出:线性激活(原样传递数值,允许任意实数)。
- 二分类输出:sigmoid(压缩到 0-1 之间,读作一个概率)。
Flashcards
记忆卡片
Active recall for this statement’s key terms.
针对本条考纲陈述关键术语的主动回忆练习。
Keep this statement’s practice with you
把这条考纲陈述的练习保存下来
Free account: save your progress and unlock every revision question for A4.3.8, and every other IB CS 2027 statement.
免费账户:解锁 A4.3.8 以及所有其他 IB CS 2027 考纲陈述的每一道复习题,并同步你的学习进度。