Parameters (weights) determine a model's prediction. A loss measures error. The gradient describes how loss changes with each parameter; gradient descent updates weights against its direction of increase.
L(w) = (w − 3)² · η = 0.2
wnext = 0 − 0.2 × (-6) = 1.2
The gradient is negative here: subtracting it increases w. With a learning rate η = 0.2, the point approaches the minimum and loss decreases. An excessively large learning rate can increase loss.
The learning rate η controls step size. An excessive step can overshoot a minimum, causing oscillation or increasing error.
| Technique | What changes |
|---|---|
| Full batch | Each update uses the entire training set. |
| Mini-batch | Each update uses a subset; updates cost less and gradients are noisier. |
| Gradient accumulation | Several micro-batches contribute to one optimizer step. Three batches of 4 examples, correctly averaged, give an effective batch of 12. |
| Norm clipping | Bounds gradient length while preserving direction. [6, 8] has norm 10; a cap of 5 gives [3, 4]. |
For nonzero g, clipping computes g × min(1, C / ||g||). A zero gradient stays unchanged.
| Split | Purpose |
|---|---|
| Train | Fit model weights and StandardScaler means/variances. |
| Validation | Select settings and the early-stopping point. |
| Test | Final evaluation after selecting settings. |
| Method | Mechanism |
|---|---|
| Decision tree | Partitions data using feature conditions. A depth limit restricts complexity. |
| Random forest | Combines trees built with randomized data and feature choices, reducing dependence among their errors. |
| Gradient boosting | Adds trees sequentially to correct current errors. For squared-error loss, residual = y − prediction: 8 − 6 = 2. |
Gini impurity = 1 − Σp_i²: two equal class shares give 0.5; a pure node gives 0. A lower boosting learning rate reduces each tree's contribution; keeping the same tree count can underfit.
Retained variance: for shares [0.60, 0.25, 0.15], two components retain 0.60 + 0.25 = 85%; reaching 90% requires all three.