➡️ Forward Propagation & Loss Functions
277 words
1 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# ➡️ Forward Propagation & Loss Functions ## 1. 🎯 Learning Objectives - Compute forward propagation through a 2-layer MLP - Implement softmax function and explain its purpose - Compare MSE vs cross-entropy loss for different problems - Trace a forward pass with actual numbers ## 2.

➡️ Forward Propagation & Loss Functions
1. 🎯 Learning Objectives
- Compute forward propagation through a 2-layer MLP
- Implement softmax function and explain its purpose
- Compare MSE vs cross-entropy loss for different problems
- Trace a forward pass with actual numbers
2. 📖 Core Content
3.1 Forward Propagation
Forward propagation computes the output of a neural network for a given input. For a 2-layer MLP:
3.2 Softmax Function
Softmax(zi)=∑jezjeziSoftmax converts logits to probabilities that sum to 1. Used for multi-class classification.
Example: Logits = [2.0, 1.0, 0.1]
Output: [0.659, 0.242, 0.099] — class 0 is most likely.
3.3 Loss Functions
Mean Squared Error (MSE): For regression:
Cross-Entropy Loss: For classification:
For binary classification:
3.4 Why Cross-Entropy for Classification?
- MSE penalizes all errors equally (probability 0.7 vs 0.8)
- Cross-entropy penalizes confident wrong predictions heavily
- Cross-entropy + softmax gradient is simpler: y^−y
4. 📝 Practice Questions
Q1: Compute cross-entropy loss for y=[1,0,0], ŷ=[0.7,0.2,0.1].Answer: L = -[1·log(0.7) + 0·log(0.2) + 0·log(0.1)] = -log(0.7) ≈ 0.357. If prediction were [0.3,0.3,0.4]: L = -log(0.3) ≈ 1.204 (higher = worse). Join Discord PreviousPerceptron to MLPNextBackpropagation