The Loss Function
- (Harvard University - Harvard Taiwan Student Association)
- Overview
A loss function quantifies how far a model's prediction is from the target or objective, giving an optimization algorithm a clear signal to reduce error. Minimizing this value guides parameter updates so the model improves on its task.
1. How Loss and Objectives Work Across Learning Types:
- Supervised learning: Compares predicted outputs against ground-truth labels using error metrics such as mean squared error or cross-entropy loss.
- Unsupervised learning: Uses structural or reconstruction objectives - such as reconstruction error in autoencoders or distance/density criteria in clustering - to shape representations from unlabeled data.
- Reinforcement learning: Optimizes cumulative reward signals over actions and states, often framing objectives as minimizing negative expected return or temporal-difference error.
2. Why Loss Functions Matter:
- Direction for optimization: Gradients or policy updates rely on the objective to adjust weights in the right direction.
- Task alignment: Choosing the right loss shapes what the model prioritizes, such as penalizing large outliers or calibration errors.
- Regularization control: Penalty terms can be added to the loss to prevent overfitting and improve generalization.
[More to come ...]

