aNet.ai
Machine Learning/Formula notebook
0day streak0XP · Lv 1

Formula notebook

All 84 formulas in the course, grouped by topic. Copy any of them as LaTeX.

84 formulas

01 Introduction to Machine Learning

SIR model

Slides

Flow between Susceptible, Infected and Recovered compartments.

transmission rate
recovery rate
population size

Dataset

A supervised dataset: n examples, each a feature vector with its label.

02 Mathematical Foundations

Inner product

Element-wise products summed; relates to the angle between vectors.

Manhattan distance

Slides

Sum of absolute differences (L1).

Euclidean distance

Slides

Straight-line distance (L2).

Lp norm

p = 1 Manhattan, p = 2 Euclidean, p → ∞ max-norm.

Jacobian matrix

Slides

Derivative of a vector-valued function; how it transforms local space.

Expectation

Probability-weighted average.

Variance

Expected squared distance from the mean.

Covariance

Positive when X and Y tend to rise together.

Bayes' theorem

Posterior = likelihood × prior / evidence.

03 Learning & Generalization

Bias–variance decomposition

Expected error = squared bias + variance + irreducible noise.

Ridge objective

L2 penalty shrinks all weights.

Lasso objective

L1 penalty sets some weights exactly to zero.

04 Learning as an Optimization Problem

Expected risk

Average loss over the true (unknown) data distribution.

Empirical risk

Average loss on the training sample.

ERM

Pick the hypothesis with the lowest training loss.

Gradient descent

Step against the gradient with learning rate η.

Mini-batch gradient

Gradient estimated on a batch B; |B| = 1 is SGD.

05 Similarity / Divergence Measures

F-divergence

Slides

Convex f with f(1) = 0; a ratio-based divergence.

KL divergence (discrete)

Slides

Asymmetric; in [0, ∞); infinite for non-overlapping supports.

KL divergence (continuous)

Slides

Continuous form of KL.

JS divergence

Slides

Symmetric; equals log 2 for non-overlapping distributions.

Pearson χ²

Squared differences weighted by Q.

Neyman χ²

Squared differences weighted by P.

Total variation

Largest difference in probability assigned to any event.

Hellinger distance

Bounded in [0, 1] and symmetric.

Integral Probability Metric

Slides

The function class 𝓕 decides which metric you get.

Wasserstein-1

Kantorovich–Rubinstein dual form; used by WGAN.

MMD

x, x' ~ P and y, y' ~ Q, with kernel k.

Kolmogorov distance

Largest gap between CDFs.

Cramér distance

Integrated squared gap between CDFs.

06 Linear Regression

Linear model

Weighted sum of features plus intercept.

Least squares loss

Sum of squared residuals.

Normal equation

Closed-form least-squares solution.

MSE gradient

Used for gradient-descent training.

RMSE

Error in the target's units; punishes big errors.

MAE

Average absolute error; robust to outliers.

R²

Fraction of variance explained; 1 is perfect.

07 Classification

Sigmoid

Maps any real number into (0, 1).

Logistic model

Probability of the positive class.

Binary cross-entropy

Negative log-likelihood of Bernoulli labels.

Softmax

K scores to K probabilities that sum to 1.

08 Model Evaluation

Accuracy

Share of correct predictions.

Precision

Of predicted positives, how many are right.

Recall

Of actual positives, how many were found.

F1-score

Harmonic mean of precision P and recall R.

True / false positive rate

The two axes of the ROC curve.

09 Overfitting and Regularization

Regularized objective

Data fit plus a complexity penalty Ω.

Ridge closed form

λI keeps the matrix invertible.

10 Decision Trees & Ensemble Learning

Entropy

0 for a pure node, 1 bit for a 50/50 split.

Information gain

Entropy reduction from splitting on A.

Gini impurity

Alternative impurity used by CART.

Boosting

Each stage adds a small model with learning rate ν.

11 Support Vector Machines

Margin

Maximise the margin by minimising ‖w‖.

Soft-margin SVM

Margin plus hinge penalties.

RBF kernel

Similarity decaying with distance.

12 Nearest-Neighbor & Probabilistic Methods

k-NN prediction

Majority vote among the k nearest neighbours.

Naïve Bayes

Prior × product of per-feature likelihoods.

13 Unsupervised Learning

k-means objective

Within-cluster sum of squares.

Silhouette

Near 1 means well clustered.

14 Dimensionality Reduction

Covariance matrix

d × d feature covariances.

Principal directions

λ_k is the variance along v_k.

Variance maximization

First component keeps the most variance.

Reconstruction error

Equivalent view: best low-rank reconstruction.

SVD

Columns of V are the principal directions of centred X.

Explained variance ratio

Share of variance captured by component k.

15 Introductory Neural Networks

Neuron

Weighted sum through an activation φ.

Perceptron update

Adjust weights only on mistakes.

Sigmoid / tanh / ReLU

Ranges (0,1), (−1,1) and [0,∞).

Layer forward pass

Each layer transforms the previous one.

Backpropagation

Errors flow backwards via the chain rule.

2D convolution

Slides

Slide kernel K over image I and sum products.

Convolution output size

Slides

Input n, padding p, kernel k, stride s.

2D Gaussian kernel

Slides

Smoothing filter; largest weight at the centre.

L2 pooling

Slides

L2 norm of each pooling region R.

16 Advanced Topics

GAN game (general)

Slides

D maximises the discrepancy; G minimises it.

Generative model goal

Slides

Make the generated distribution match the data.

Vanilla GAN objective

The original JS-based formulation.

Two-sample test

Slides

Distribution-level view of the discriminator.

Boltzmann distribution

Lower energy means higher probability; Z normalises.

RBM energy

Visible–hidden interactions only.

17 Distributed ML

Federated averaging

Global model = data-weighted average of client models.

Data-parallel gradient

Each worker computes a gradient on its shard; results are averaged.

aNet.ai · Introduction to Machine Learning · NewUU course outlineProgress saved in this browser