激活函数 · 把线性和变成非线性输出Activation Function · Turn a Linear Sum into a Nonlinear Output
weighted sum z → activation f(z) → neuron output
激活函数把神经元的线性加权和变成非线性输出。没有非线性,多层线性计算合起来仍只是一条直线,无法获得弯折或
S 形表达。An activation function turns a neuron's linear weighted sum into a nonlinear output. Without nonlinearity, stacked
linear layers collapse into another straight line and cannot express bends or S-curves.
01 · 多条直尺拼不出弯线01 · Stacked rulers still draw straight
如果每一层都只做直线变换,叠再多层能不能画出真正的弯曲关系?If every layer performs only a straight-line transform, can stacking more layers create a genuinely curved
relationship?
ƒ
02同一输入,切换三种激活Same Input, Three Activations
曲线切换型Curve switching
当前函数Current function
z
f(z)
当前输出Current output
−1.00
f(z)
曲线形状Curve shape
—
可表达关系expressible relation
红点是当前 z 对应的输出。先固定 z =
−1,再切换三种函数,比较输出和整条曲线。The red dot is the output for the current z. Keep z = −1 and switch functions to compare both the output and
full curve.
03三种选择各做什么What the Three Choices Do
同一 z,不同 fSame z, different f
NONE
无激活No activation
输出等于输入,曲线保持直线。Output equals input, so the curve stays straight.
RELU
ReLU
负数压成 0,正数原样通过,形成折角。Negative values become zero; positive values pass through, creating a hinge.
SIGMOID
sigmoid
把所有输入平滑压到 0 与 1 之间,形成 S 形。All inputs compress smoothly between zero and one, forming an S-curve.
WHY
非线性Nonlinearity
折角或弯曲让多层组合能表达直线做不到的形状。Bends let stacked layers express shapes unavailable to straight lines.
04最小机制:对加权和再做一次函数变换Minimal Mechanism: Transform the Weighted Sum Once More
y = f(z)
z = Σ xiwi + b ; y = f(z)
上方只替换 f,z
不变。比较同一个红点在三条曲线中的位置,就能把激活的作用与权重计算分开。Only f changes above; z stays fixed. Compare the same red input across curves to isolate activation from the
weighted-sum calculation.
得到线性和 zCompute linear z乘加先完成Multiply-add completes
选择 fChoose f直线、折角或 S 形Line, hinge, or S-curve
输出 yProduce y非线性进入下一层Nonlinearity enters next layer
05边界实验:叠两层但不加激活Boundary Test: Stack Two Layers Without Activation
主动制造失败Create a failure
两条直线仍合成一条直线Two lines still collapse into one
点击后模拟 y = 2(0.5z + 1) − 2。虽然写了两层,化简后仍是 y =
z,无法产生弯折。Simulate y = 2(0.5z + 1) − 2. It uses two layers but simplifies to y = z, so no bend appears.
尚未执行。当前可自由切换激活函数。Not run yet. You can currently switch activations freely.
✗ 多叠线性层自然会变成非线性。Stacking linear layers naturally becomes nonlinear.
→ ✓ 线性变换的组合仍是线性变换。A composition of linear transforms remains linear.
✗ 激活函数会改变原始输入。An activation changes the original input.
→ ✓ 它变换的是神经元已经算出的加权和 z。It transforms the neuron's computed weighted sum z.
✗ sigmoid 输出就是真实概率。A sigmoid output is automatically a real probability.
→ ✓ 形状落在 0 到 1 不代表已经校准为概率。A 0-to-1 range does not guarantee calibrated probability.
06 · 一句话带走06 · One line to keep
激活函数把线性加权和变成非线性输出;在无激活、ReLU 与 sigmoid
间切换,就能检验同一输入怎样得到直线、折角或 S 形。An activation function turns a linear weighted sum into a nonlinear output. Switch among none, ReLU, and sigmoid
to verify how the same input yields a line, hinge, or S-curve.