1. Mathematical Fundamentals & Modeling¶
Linear regression models the relationship between labeled examples .
Feature Vectors: .
Hypothesis Function: , where .
Design Matrix (): Stacks inputs into .
Deterministic Perspective: Minimizes the Residual Sum of Squares (RSS), .
Probabilistic Perspective: Assumes noise . Maximum Likelihood Estimation (MLE) of with Gaussian noise is equivalent to minimizing RSS.
2. Optimization Algorithms¶
Gradient Descent (GD)¶
Update Rule: , where .
Convergence: For strongly convex functions with Lipschitz constant and parameter , using step size yields an iteration complexity of .
Stochastic Gradient Descent (SGD)¶
Mechanism: Updates parameters using a single randomly chosen sample .
Gradient Estimate: .
Advantage: Efficient for large datasets where computing the full gradient is expensive.
Comparison of Methods
| Method | Solution Type | Complexity | Best Use Case |
|---|---|---|---|
| Analytical | Moderate and ; exact solution needed. | ||
| GD | Iterative Approx. | Large but moderate . | |
| SGD | Iterative Approx. | Both and are very large. |
3. Advanced Modeling Techniques¶
Multiple Outputs & Classification¶
Multiple Outputs: For vector-valued , the objective is . This is equivalent to solving independent regression problems.
Binary Classification: Uses and a prediction rule .
Multi-Category Classification: Uses one-hot encoding for labels . Prediction follows .
Polynomial Regression¶
Feature Mapping: Maps data to a higher-dimensional space to handle non-linearly separable data (e.g., the XOR problem).
Expanded Matrix: Linear regression is applied to the expanded design matrix .
4. Regularization (MAP Estimation)¶
Regularization adds a penalty term to the loss to avoid overfitting and ensure is invertible.
Ridge Regression ( Penalty):
Objective: .
Prior: Equivalent to MAP with a Gaussian prior .
Solution: .
Lasso Regression ( Penalty):
Objective: .
Prior: Equivalent to MAP with a Laplacian prior.
Property: Encourages sparsity in weights.
5. Robust Linear Regression¶
The Problem: Least squares ( loss) is highly sensitive to outliers because errors are squared.
The Solution: Replace loss with loss ().
Probabilistic View: regression is the MLE solution when observation noise follows a Laplacian distribution rather than a Gaussian one.