Exercise 1 – Computing Softmax Probabilities
The softmax function transforms a vector of real-valued scores \( \mathbf{z} = [z_1, z_2, \ldots, z_K] \) into a probability distribution over \( K \) classes. The softmax probability for class \( i \) is:
\[
\sigma(\mathbf{z})_i = \frac{e^{z_i}}{\sum_{j=1}^K e^{z_j}}
\]
Given a score vector \( \mathbf{z} = [0, 1, -1] \), compute the softmax probabilities for each class.
Question:
What is the softmax probability for the second class (corresponding to \( z_2 = 1 \))? Round to 3 decimal places.
1. Compute \( e^{z_i} \) for each \( z_i \).
2. Calculate the sum \( \sum_{j=1}^3 e^{z_j} \).
3. Compute \( \sigma(\mathbf{z})_2 = \frac{e^{z_2}}{\sum_{j=1}^3 e^{z_j}} \).
Question:
What is the softmax probability for the second class (corresponding to \( z_2 = 1 \))? Round to 3 decimal places.
1. Compute \( e^{z_i} \) for each \( z_i \).
2. Calculate the sum \( \sum_{j=1}^3 e^{z_j} \).
3. Compute \( \sigma(\mathbf{z})_2 = \frac{e^{z_2}}{\sum_{j=1}^3 e^{z_j}} \).