Machine Learning Formula Sheet

Gradient descent with momentum updates, confusion-matrix metrics (precision, recall, F1, MCC), and neural network activation functions with exact derivatives.

Core Equations & Variable Definitions

Gradient Descent with Momentum

v_t = \beta v_{t-1} + \nabla L(\theta_t), \quad \theta_{t+1} = \theta_t - \eta v_t

eta: learning rate, beta: momentum coefficient (typically 0.9).

Precision, Recall & F1 Score

P = \frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FP}}, \quad R = \frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FN}}, \quad F_1 = \frac{2 P R}{P + R}

F1 is the harmonic mean of precision and recall, penalizing extreme imbalance.

Matthews Correlation Coefficient (MCC)

\mathrm{MCC} = \frac{\mathrm{TP}\cdot\mathrm{TN} - \mathrm{FP}\cdot\mathrm{FN}}{\sqrt{(\mathrm{TP}+\mathrm{FP})(\mathrm{TP}+\mathrm{FN})(\mathrm{TN}+\mathrm{FP})(\mathrm{TN}+\mathrm{FN})}}

Balanced [-1, +1] score reliable even on heavily skewed datasets.

Sigmoid & ReLU Derivatives

\sigma'(z) = \sigma(z)(1 - \sigma(z)), \quad \mathrm{ReLU}'(z) = \begin{cases} 1 & z > 0 \\ 0 & z < 0 \end{cases}

Sigmoid saturates near 0 and 1 (max derivative 0.25), causing vanishing gradients.

Interactive Machine Learning Calculators

Common Exam Questions

Why is accuracy misleading on imbalanced classification datasets?

If 99% of samples are negative, a trivial model predicting all negatives scores 99% accuracy while achieving 0% recall. Use F1 score, PR-AUC, or MCC instead.

What happens if the gradient descent learning rate is too high?

An oversized learning rate overshoots the valley minimum, causing loss to oscillate or diverge to infinity.

Why do modern transformers prefer GELU or Swish over Sigmoid?

Smooth non-saturating activations like GELU and Swish avoid vanishing positive gradients while maintaining clean gradient flow near zero.