// REF. 17 / MACHINE LEARNING

Machine Learning cheat sheet

The metrics here follow scikit-learn's definitions, current to October 2026. One number never tells the whole story: read precision with recall, and never trust accuracy on an imbalanced set.

The habit that saves you most pain is honest splits. Fit on train, tune on validation, and touch the test set exactly once, at the end.

↓ Download the printable PDF free · letter size · no email needed

Splits

train/val/test
fit on train, tune on val, report on test
k-fold CV
k train/test rotations, average the score
stratified
keep class ratios in each fold
leakage
test info bleeds into training
time split
no future rows in train for time series

Losses

MSE
mean squared error, penalizes big misses
MAE
mean absolute error, robust to outliers
cross-entropy
log loss for probabilistic classes
BCE
binary cross-entropy, two-class log loss
hinge
max(0, 1 - y*score), svm margin loss
huber
mse near zero, mae in the tails

Class metrics

accuracy
fraction of predictions correct
precision
tp / (tp + fp), of predicted positives
recall
tp / (tp + fn), of actual positives
F1
harmonic mean of precision and recall
ROC-AUC
tpr vs fpr across all thresholds
PR-AUC
precision vs recall, better when rare
confusion matrix
tn, fp, fn, tp counts per class

Regression metrics

R²
1 - SSres/SStot, variance explained
RMSE
sqrt of mean squared error, in units
MAE
mean absolute error, in units
MAPE
mean absolute percent error, breaks at 0

Bias/variance

underfit
high bias, too simple for the data
overfit
high variance, memorizes the train set
bias-variance
trade total error between the two
learning curve
train vs val score as data grows
val gap
big train-val gap means overfitting

Regularization

L2 / weight decay
shrink weights toward zero
L1 / lasso
shrink weights, drives some to zero
dropout
zero random units during training
early stopping
halt when val loss stops improving
augmentation
synthetic variants grow the train set
batch norm
normalize activations, eases training

Optimization

SGD
step down the gradient per minibatch
momentum
accumulate past gradients, less zigzag
Adam
adaptive per-parameter learning rates
learning rate
step size, the key knob to tune
batch size
rows per gradient step
warmup
ramp lr up early to stabilize
lr schedule
decay lr over training, e.g. cosine

Features

scaling
standardize or min-max before fit
one-hot
categorical to binary columns
embeddings
dense learned vectors for categories
target encoding
category to mean target, leak-prone
imputation
fill missing, fit on train only

Footguns

accuracy on rare
99% by always guessing the majority
tuning on test
leaks the test set, inflates scores
no fixed seed
runs are not reproducible
scale after split
fit the scaler on train, or you leak
Machine Learning Field Manual Desk Mat

// KEEP IT UNDER YOUR KEYBOARD

Machine Learning Field Manual Desk Mat

from $34 · printed to order in the USA

See the desk mat