GATE DA Machine Learning formula sheet
Core formulas for GATE DA machine learning: regression, classification (logistic, k-NN, naive Bayes, LDA, SVM, decision trees), bias-variance, cross-validation, neural networks, clustering and PCA.
55 formulas · updated 2026-11-14 · reviewed 2026-11-14 · Spotted an error? Tell us
Regression: simple, multiple and ridge
Regression vs classification loss
Regression predicts a real-valued target; classification predicts a discrete label.
Simple linear regression (OLS)
The fitted line always passes through .
Residual properties
Hold for least squares with an intercept term; in matrix form .
Coefficient of determination
For simple linear regression with intercept, (squared correlation).
Multiple regression (normal equations)
Minimizes ; needs invertible (full column rank). Add a column of 1s for the intercept.
Hat matrix
p = number of columns of X (including the intercept column). Diagonal entries are leverages.
Ridge regression
For the matrix is always invertible. Shrinks coefficients towards 0 but not exactly to 0; intercept usually not penalized.
Ridge, one feature, no intercept
gives OLS; gives . Larger : higher bias, lower variance.
Logistic regression
Sigmoid function
; maximum slope .
Model and log-odds
Log-odds are linear in x; increasing by 1 multiplies the odds by .
Decision boundary
With threshold 0.5 the boundary is a hyperplane, so logistic regression is a linear classifier.
Cross-entropy loss and gradient
Here , . Loss is convex but has no closed-form minimizer; use gradient methods.
Softmax (multi-class)
Probabilities sum to 1; adding the same constant to every does not change the output.
k-nearest neighbour and naive Bayes
Distance metrics
Manhattan, Euclidean, Chebyshev (). Scale features first.
k-NN prediction
Small k: low bias, high variance (1-NN has zero training error if no duplicate points with different labels). Large k: smoother, higher bias.
Bayes' theorem
Posterior is proportional to likelihood times prior; denominator is the same for all classes.
Naive Bayes classifier
Assumes features are conditionally independent given the class. Use sums of logs to avoid underflow.
Laplace (add-one) smoothing
= training examples of class c, = number of possible values of feature j. Avoids zero probabilities wiping out the product.
Gaussian naive Bayes
For continuous features; are the mean and variance of feature j within class c.
Linear discriminant analysis and SVM
LDA discriminant function
Assumes Gaussian classes with a common covariance ; predict . Boundaries are linear (unequal covariances give quadratic QDA).
1-D LDA threshold
For two classes with equal variance and equal priors. Unequal priors shift the threshold towards the less likely class mean.
Fisher's linear discriminant
, . With K classes, at most directions.
Distance to hyperplane
Signed distance drops the absolute value; sign tells the side of the hyperplane.
Hard-margin SVM
Labels ; requires linearly separable data. Distance from boundary to nearest point is .
Soft-margin SVM
Large C: fewer margin violations, narrower margin (risk of overfitting). Small C: wider margin, more violations.
Hinge loss
Zero only when the point is correctly classified with (outside or on the margin).
SVM dual and support vectors
Only support vectors have ; removing a non-support vector does not change the solution. Hard margin: .
Kernels
Linear, polynomial, RBF. A valid kernel must give a symmetric positive semidefinite Gram matrix (Mercer).
Decision trees
Entropy
0 for a pure node; maximum for a uniform split (1 bit for a 50/50 binary node). Take .
Information gain
ID3 picks the attribute with the largest gain. IG is always .
Gini index
Used by CART; 0 for a pure node, maximum (0.5 for binary).
Misclassification error
Less sensitive to node purity changes than entropy or Gini; mainly used for pruning.
Gain ratio
C4.5 criterion; the denominator (split information) penalizes attributes with many values, which IG favours.
Regression tree
Deep trees have low bias and high variance; limit depth or prune to reduce overfitting.
Bias-variance trade-off and cross-validation
Bias-variance decomposition
For , , ; expectation over training sets and noise. is irreducible error.
Complexity trend
Underfitting = high bias (high train and test error); overfitting = high variance (low train, high test error). Ridge or k-NN lowers variance, raises bias.
k-fold cross-validation
Split data into k folds; train on folds (about points), test on the held-out fold. k model fits; each point is validated exactly once.
Leave-one-out CV
k-fold with : n fits, each on points. Nearly unbiased but higher-variance estimate; no randomness in the splits.
LOOCV shortcut for least squares
Exact for ordinary least squares (linear regression) using one full fit; is the leverage from the hat matrix.
Multi-layer perceptron and feed-forward networks
Perceptron
Labels . Converges in finitely many updates if the data are linearly separable; a single perceptron cannot learn XOR.
Forward pass
. has shape .
Parameter count
Weights plus biases per fully connected layer.
Activation functions
ReLU derivative is 1 for , 0 for . Sigmoid/tanh saturate, causing vanishing gradients.
Linear layers collapse
Without non-linear activations, any depth of network is just a linear model.
Backpropagation
; start from the output layer .
Softmax/sigmoid + cross-entropy gradient
Holds for softmax with categorical cross-entropy (one-hot y) and for sigmoid with binary cross-entropy.
Gradient descent update
Batch uses all data, stochastic uses one example, mini-batch uses a subset per step.
Clustering and PCA
k-means objective
Alternate: assign each point to nearest centroid, then recompute means. J never increases; converges to a local (not necessarily global) minimum that depends on initialization.
k-medoid
The medoid is an actual data point; works with any dissimilarity and is more robust to outliers than k-means (e.g. PAM).
Hierarchical linkage criteria
Single linkage tends to chain; complete linkage gives compact clusters. Agglomerative (bottom-up) does merges; divisive is top-down. Cut the dendrogram to get clusters.
PCA: covariance and eigenvectors
Center the data first. Principal components are eigenvectors of S ordered by ; they are orthonormal. ( scaling gives the same directions.)
First principal component
Variance of the data projected on equals ; projected scores on different PCs are uncorrelated.
Explained variance
Total variance equals the sum of feature variances; keep the top m PCs that capture the desired fraction.
Projection and reconstruction
holds the top m eigenvectors as columns. Average reconstruction error equals the sum of discarded eigenvalues (with the covariance).
PCA via SVD
is the centered data matrix; PCs are the columns of V (right singular vectors).