Neural Networks
Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6
7 cards in “6.1 Units” · whole deck
6.1 Units
- What does a single neural unit compute?A weighted sum of its inputs plus a bias, \(z = w \cdot x + b\), then a non-linear activation function: \(a = f(z)\).
Weighted sum, bias, non-linearity. - Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6, §6.1, p. 152
- What is the activation value of a unit?The output \(a = f(z)\) of its non-linear function. For a single-unit network it is also the network output \(y\).
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6, §6.1, p. 152
- Compute the output of a sigmoid unit with \(w = [0.2, 0.3, 0.9]\), \(b = 0.5\), on \(x = [0.5, 0.6, 0.1]\).\(z = 0.1 + 0.18 + 0.09 + 0.5 = 0.87\), so \(y = \sigma(0.87) = \frac{1}{1 + e^{-0.87}} \approx 0.70\).
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6, §6.1, p. 153
- What is the tanh activation function, and how does it compare to the sigmoid?\(\tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}}\), a variant of the sigmoid ranging from −1 to +1. It is almost always better than the sigmoid; it is smoothly differentiable and maps outliers toward the mean.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6, §6.1, p. 153
- What is the ReLU?The rectified linear unit, \(\text{ReLU}(z) = \max(z, 0)\): equal to \(z\) when positive, 0 otherwise. The simplest and perhaps most commonly used activation.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6, §6.1, p. 153
- What does it mean for a sigmoid or tanh unit to be saturated, and why is that a problem?For large |z| its output is extremely close to its limit and its derivative is close to 0. Since training multiplies gradients across layers, near-zero gradients shrink the error signal until it is too small to learn from: the vanishing gradient problem.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6, §6.1, p. 154
- Why don’t ReLUs suffer from the vanishing gradient problem?They are close to linear: for positive \(z\) the derivative is 1, not close to 0.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 6, §6.1, p. 154
Source
- Daniel Jurafsky and James H. Martin. Speech and Language Processing. 3rd edition (draft). https://web.stanford.edu/~jurafsky/slp3/