Master Mathematics.

Machine Learning

1. Regression

  • Least squares: minimise ; the solution solves . Through the origin in one variable, .
  • Ridge regression adds : ; it shrinks weights, raising bias and lowering variance. Lasso adds and sets some weights to .
  • Losses: squared error, absolute error (MAE), and the total regularised loss data loss penalty.
  • Gradient descent: ; stochastic gradient descent uses one example (or a mini-batch) per step.
  • Logistic regression: with and ; trained by maximising the log-likelihood.

2. Classification

  • Generative vs discriminative: naive Bayes models ; logistic regression models .
  • Naive Bayes: assumes features independent given the class; with binary features and two classes it has parameters. Predict the class with the largest ; the error at is the smaller posterior.
  • -nearest neighbours: majority label among the closest points; odd avoids ties.
  • Linear classifiers: . The perceptron updates , on a mistake, raising by . The nearest-mean classifier is linear.
  • Hard-margin SVM: maximise the margin subject to ; the support vectors lie on . Data must be linearly separable (XOR-like data is not).
  • Fisher LDA: maximise ; the optimum satisfies .
  • Decision trees: split on the attribute with the largest information gain , with entropy .

3. Clustering & dimensionality reduction

  • -means: alternate assigning points to the nearest centre and moving each centre to its cluster's mean; each cluster is convex (a Voronoi cell).
  • K-medoids: centres must be data points; more robust to outliers.
  • Hierarchical clustering: repeatedly merge the two closest clusters. Single linkage uses the closest pair, complete linkage the farthest, average linkage the mean distance; the result is a dendrogram.
  • Distances: Euclidean, Manhattan , cosine.
  • PCA: the principal components are orthogonal eigenvectors of the covariance matrix; the variance along the -th is , and keeping the top keeps of the variance.

4. Neural networks

  • Neuron: with activation : ReLU (continuous, not differentiable at ), sigmoid, tanh.
  • Parameters: a fully connected layer from to units has weights (plus biases).
  • ReLU networks with positive inputs and weights act linearly; the end-to-end weight is the sum over paths of the products of weights.
  • Backpropagation: the chain rule layer by layer; a ReLU unit with negative input passes gradient .
  • Training: loss (squared error, cross-entropy), gradient descent, regularisation (weight decay, dropout), early stopping.

5. Bias, variance & evaluation

  • Bias–variance: expected test error bias variance noise. Simple models underfit (high bias); complex models overfit (high variance).
  • Validation: hold-out sets, -fold cross-validation, leave-one-out ( splits for training points). Never tune on the test set.
  • Confusion matrix: accuracy , precision , recall , .
  • Preprocessing: z-score ; min–max scaling .

6. Search, logic & reasoning (AI)

  • Uninformed search: BFS (complete, optimal for unit costs), DFS, depth-limited, iterative deepening, uniform cost.
  • A*: expand the node with the smallest . is admissible if (then A* is optimal); and of admissible heuristics are admissible.
  • Minimax and – pruning: is the best value MAX can guarantee so far, the best for MIN; prune when .
  • Propositional logic: ; contrapositive ; entails iff is unsatisfiable.
  • First-order logic: "all are " is ; "some is " is .
  • Bayesian networks: . Given a node, its children are independent of its parents' other descendants; two parents become dependent given their common child. Variable elimination is exact; Gibbs, rejection and likelihood-weighted sampling are approximate.