The Modern Mathematics of Deep Learningexplained for non-mathematicians

Activation functions

Penguin learning project

The project uses 342 complete Palmer penguin records: 240 training-pool and 102 held-out rows. The selected training rows determine feature scaling and model parameters. Source CSV

This project trains weights with softmax, unlike the homepage lab, which uses nearest species averages. Same penguin measurements; different classification methods. Predictions can differ.

Prediction rules and layers · Describe or apply prediction rules, layers and parameters.

The project uses a linear rule with two features. The fitted weights produce scores or normalized mass.

Consider this concept alongside the project; its source assumptions may differ. These observations do not prove a theorem.

Input: 12 × 2; Held-out evaluation: 102 · #58 · 40.6 mm, 193 mm. Known answer: Adélie; Prediction: Adélie · [≈0.7383, ≈0.2444, ≈0.01737].

Used in these source sections: 1.2 Learning from examples · 3.3 Other ways to measure possibility · 4.2 Approximating with random pieces

An activation changes a number using a fixed rule. The source table lists several choices.

The step function is 1 only when x > 0. ReLU is zero for negative x. Sigmoid approaches 0 and 1. The other results show the source table’s formulas.

Different activations give networks different mathematical properties.

Source formula example

ϱR(x)=max⁡{0,x},ϱσ(x)=11+e−x\varrho_R(x)=\max\{0,x\},\qquad\varrho_\sigma(x)=\frac1{1+e^{-x}}

exact · The result is exact for these finite toy inputs, apart from ordinary computer rounding.

Symbols

xx
A real input.
aa
A positive parameter in the inverse-square-root examples; PReLU additionally excludes a = 1.
kk
A positive integer exponent.

Source formula example

This source example uses its own inputs and assumptions. Editing it does not change the project.

Edit a value or the code, then run the example. This is a finite demonstration, not a proof of the paper’s theorem.

This example’s data flow

You choose

  • input.x = 0
  • input.a = 0.5
  • input.k = 2

Calculated here

Result expression: { linear: x, step: x > 0 ? 1 : 0, sigmoid: 1 / (1 + Math.exp(-x)), relu, powerRelu: relu ** k, parametricRelu: Math.max(a * x, x), elu: x >= 0 ? x : Math.exp(x) - 1, softsign: x / (1 + Math.abs(x)), inverseSqrtLinear: x...

  • x = input.x Uses: input.x
  • a = input.a Uses: input.a
  • k = input.k Uses: input.k
  • relu = Math.max(0, x) Uses: x

Returns

Example result
linear
0
step
0
sigmoid
0.5
relu
0
powerRelu
0
parametricRelu
0
elu
0
softsign
0
… (14 items)

Read numbers from input and return the result. JavaScript basics.

Result

Enable JavaScript to run this example.

Technical statement

The table includes linear, Heaviside, sigmoid, ReLU, power ReLU, parametric ReLU, ELU, softsign, inverse-square-root linear unit, inverse-square-root unit, tanh, arctan, softplus and Gaussian. The displayed code computes each value. The source allows a = 0 for parametric ReLU, but the shared parameter here must also satisfy the positive constraint of the inverse-square-root examples.

Source: Table 1.1