Blog
ML concepts, explained so they stick
ML concepts explained in plain language, one idea at a time, with the math and the code side by side.
Start here
How to learn ML
How to learn machine learning in 2026: a complete roadmap for self-taught learners
The order to learn machine learning on your own: Python, the math that ML uses, PyTorch, then training and evaluating deep networks, with every concept named so you know exactly what is ahead of you.
How to learn ML
How to learn machine learning effectively (and actually remember it)
Most people finish an ML course and cannot use it a month later. This post covers what to learn in which order, how to practice so the concepts stay, and a weekly schedule you can keep with 30 to 45 minutes a day.
What NLP is
How to learn NLP in 2026: a complete roadmap from text to LLMs
What to learn for natural language processing and in what order, from tokenization and word embeddings to transformers, LLMs and post-training, so you can see what is ahead and check off what you already know.
Browse by track
Learning and careers
How to learn ML, what to learn first, and how to get hired.
7 posts
ML Foundations
How models learn, neural networks, optimization, generalization, and evaluation.
49 posts
Math for ML
Linear algebra, calculus, probability, and information theory, as ML uses them.
62 posts
NLP
From text and tokenization to embeddings, transformers, and LLMs.
20 posts
Computer Vision
Images as data, CNNs, vision transformers, detection, segmentation, and more.
Coming soon
All posts
Word representations
Bag of words, co-occurrence matrices, and PMI: count-based word vectors
How counting the words around each word turns raw text into vectors, with PyTorch code for a bag-of-words vector, a co-occurrence matrix and PPMI, and what each of them loses.
Word representations
How to turn words into numbers: integer encoding, one-hot, and dense vectors
How to measure whether two word vectors are close with distance and cosine similarity, why token ids and one-hot vectors cannot show which words are related, and what a dense vector changes.
Word representations
What are word embeddings?
How an embedding table turns a token id into a vector in PyTorch, why training can move those vectors, and how relationships like king to queen show up as directions, with the bug that breaks analogy search.
Tokenization
BPE vs WordPiece vs Unigram tokenization
A worked example where BPE and WordPiece merge different pairs, how the ## marker works, and the score Unigram uses to choose between ways of cutting a word.
Tokenization
How to use a Hugging Face tokenizer: special tokens, token IDs, padding, and batches
How to load a pretrained tokenizer and read what it returns, the four stages a string passes through, and how to batch sentences of different lengths with padding and truncation.
Tokenization
Why LLMs miscount letters: tokenization quirks and non-English text
What GPT-2's tokenizer does to a word, a number and an emoji, how many tokens one sentence takes in four languages, and why some tokens make a model behave strangely.
Tokenization
Byte pair encoding (BPE) explained step by step, including byte-level BPE
How BPE builds a subword vocabulary from counts alone, a worked example you can check by hand, the three short Python functions behind it, and why byte-level BPE never needs an unknown token.
Text as data
Privacy and licensing: can you train a model on scraped text?
What to check before you collect or publish a text dataset, what a dataset license spells out, and a short Python example that masks emails, phone numbers and IP addresses.
Tokenization
What is tokenization in NLP? Word, character, and subword tokens
Why a language model needs text cut into pieces first, the three questions that decide how big a piece should be, and why most models today use subword tokens instead of whole words or single characters.
Text as data
How to handle class imbalance in text classification
Why a spam filter can score 98% accuracy while catching no spam, which numbers to report instead, and how reweighting, oversampling and undersampling work in PyTorch, with what each one costs.
Text as data
Data quality problems in NLP: duplicates, contamination, bias, and representativeness
The problems to check for in a text dataset before training, how each one changes a model's scores, and short Python checks for duplicates, train/test overlap and test-set size.
Text as data
Text preprocessing in NLP: normalization, stemming vs lemmatization, and stopwords
What each classic cleanup step does to a sentence, with runnable NLTK code, where each one erases something a model could use, and how much of it to apply for a count-based model versus a transformer.
Text as data
Data annotation for NLP: crowdsourcing vs experts, and inter-annotator agreement
How to design labels people can apply consistently, when to pay a crowd and when to hire experts, and how to compute Cohen's kappa to check whether your labels can be trusted.
Text as data
How to build your own NLP dataset: selecting data, extracting text, documenting it
How to choose the text for a custom dataset and pull clean text out of web pages, PDFs and scans, plus what to write down so the next person can trust it.
Text as data
Where to find NLP datasets: Hugging Face Hub, Kaggle, and more
Which places to search for a text dataset, how to load one in Python, and what to check before you train anything on it.
What NLP is
A short history of NLP: from ELIZA to deep learning
The four eras NLP went through on its way to today's large models, why each shift happened, and what the 1960s chatbot ELIZA shows about sounding smart without understanding anything.
Text as data
Unicode and UTF-8 explained: how computers store text
How a character becomes a code point and then bytes, why the same word can take a different number of bytes in different scripts, and how to fix text that compares wrong or shows up garbled.
Text as data
Why text is hard data for machine learning
How raw text differs from tables and images, and the three decisions an NLP system has to make before a model can learn anything from it.
Numerical computation
Exponential moving average (EMA) explained
How the EMA update works, why it starts too low and how bias correction fixes that, and how to read a beta like 0.9 or 0.999 as a window.
Numerical computation
The log-sum-exp trick explained: overflow, underflow, and adding logs
Why exp(1000) returns inf, why a product of 500 small probabilities returns 0, and how factoring out the largest value lets you add numbers stored as logs in PyTorch.
What NLP is
What is NLP? Natural language processing explained
The main NLP tasks from sentiment analysis to language modeling, the kinds of ambiguity that make human language hard for a computer, and why modern NLP learns from data instead of following hand-written rules.
Numerical computation
Floating-point numbers explained: float32, float64, and rounding errors
Why 0.1 + 0.2 is not 0.3, how float32 and float64 differ, when a small number vanishes or a subtraction goes wrong, and how to compare floats safely in Python and PyTorch.
Information theory
Mutual information explained
How to compute mutual information from a joint probability table by hand and in PyTorch, how it connects to entropy and KL divergence, and where it is used in feature selection and decision trees.
Information theory
What is entropy in information theory?
How to compute entropy by hand and in PyTorch, what bits and nats are, why it can go negative for continuous variables and how the maximum entropy principle picks a distribution from a few known facts.
Probability and statistics
Bootstrap resampling explained
How to get a standard error and a 95% interval for a median, an accuracy or any other statistic without deriving a formula, with the PyTorch code and the mistakes to avoid.
Probability and statistics
Markov chain Monte Carlo (MCMC) explained
How the Metropolis-Hastings rule decides each step, why the unknown normalizing constant never has to be computed, and how many independent draws a correlated chain is worth, with a working sampler in PyTorch.
Probability and statistics
The reparameterization trick explained
How to build a Gaussian sample from a mean, a Cholesky factor and standard normal noise, why that lets gradients reach the mean, and how PyTorch's rsample does it for you.
Probability and statistics
Bayesian inference explained: priors, posteriors, and conjugate priors
How to turn a prior and a likelihood into a posterior, and how to read uncertainty and predictions off it. The PyTorch examples also update a Beta prior by counting.
Probability and statistics
Bias and variance of an estimator, and why sample variance divides by n minus 1
How to measure an estimator's bias and variance with a simulation, how they add up to mean squared error, and how to choose between the two sample variance formulas in PyTorch.
Probability and statistics
Monte Carlo methods explained: Monte Carlo estimation, importance sampling, and rejection sampling
What error to expect from an average of random samples, and how importance sampling and rejection sampling handle targets that are hard to sample from. The PyTorch examples also show why both struggle in high dimensions.
Probability and statistics
Hypothesis testing and p-values: is model A really better than model B?
How to tell whether a gap between two models is real or noise, what a p-value does and does not mean, one-sided vs two-sided tests, and why running many tests produces false winners, with PyTorch checks.
Probability and statistics
MLE vs MAP estimation
How maximum likelihood and maximum a posteriori estimation each pick a parameter from data, why MAP gives a sensible answer where MLE overreacts, and how a prior turns into L2 or L1 regularization, with PyTorch examples.
Probability and statistics
Standard error and confidence intervals explained
How to put an error bar on an average, such as a validation accuracy or a mean latency, how to compute it by hand and in PyTorch, and what 95% confidence does and does not promise.
Probability and statistics
CDF, percentiles, and quantiles explained
How to compute a CDF for discrete and continuous data, how to read a median or a 95th percentile off it, and how to do both in PyTorch on real latency data.
Probability and statistics
Covariance vs correlation
How to compute covariance and correlation by hand and in PyTorch, why correlation is the one to compare across datasets, and how covariance decides whether the uncertainty of two quantities adds up or cancels.
Probability and statistics
Expected value and variance explained, with conditional expectation
How to compute the expected value and variance of a distribution by hand and in PyTorch, what happens to them when you shift or scale the data, and why a model trained with squared error predicts a conditional mean.
Probability and statistics
Kernel density estimation explained
How KDE turns a handful of data points into a smooth density by hand and in PyTorch, how the bandwidth h changes the result, and where KDE is used for visualizing data and spotting anomalies.
Probability and statistics
The law of large numbers and the central limit theorem explained
Why sample averages settle toward the true mean and why their error is bell-shaped with a spread of sigma over root n, plus when neither result holds, with PyTorch simulations of each.
Probability and statistics
The multivariate Gaussian, covariance matrices, and Mahalanobis distance
How to read and estimate a covariance matrix and how much a full or diagonal one costs to learn, plus how Mahalanobis distance flags outliers, with PyTorch code for each step.
Probability and statistics
Common probability distributions in ML: Bernoulli, binomial, Poisson, Beta
Which distribution fits which question, the formula and mean of each one worked with real numbers, and how to check them in PyTorch.
Probability and statistics
Degrees of freedom explained
Why sample variance divides by n - 1, what the degrees of freedom of Student's t and chi-squared control, and a PyTorch simulation that shows dividing by n runs low.
Probability and statistics
The Gaussian (normal) distribution explained
What the mean and standard deviation do to the bell curve, how to standardize any Gaussian to z-scores, and why code works with the log-density, with every step checked in PyTorch.
Probability and statistics
Bayes' theorem explained with an example
Where the formula comes from, what the prior, likelihood and posterior mean, and a spam filter example worked by hand and in PyTorch, including how the prior changes the answer.
Probability and statistics
Dependent vs independent variables in machine learning
Which part of a dataset is X and which is y, the other names each one goes by (features, labels, targets, predictors), and how they look as PyTorch tensors.
Probability and statistics
Joint, marginal, and conditional probability explained, with independence
How to read a joint probability table, get a marginal by adding a row, get a conditional by dividing, test two variables for independence, and factor any joint with the chain rule, with PyTorch code.
Calculus and optimization
Convex functions explained (and why neural network losses are not convex)
How to check whether a function is convex with a chord, the Hessian or a short list of known shapes, what Jensen's inequality says, and what a convex optimization problem looks like, with PyTorch code for the chord and Hessian checks.
Calculus and optimization
Local minima and saddle points in deep learning
How to find the points where a function's gradient is zero, tell a minimum from a maximum or a saddle with the second-derivative test, and see in PyTorch why gradient descent can stall at a saddle.
Probability and statistics
Random variables and probability distributions explained: PMF vs PDF
How a die roll and a classifier's output are both described by a distribution, the two rules every distribution follows, and why a density can be larger than 1 while a probability cannot, with PyTorch code.
Calculus and optimization
Automatic differentiation explained: how autograd works
How PyTorch gets the gradient of a loss for millions of parameters in one backward pass, why it walks the computation graph from the output back to the inputs, and when forward mode is the better fit, with code you can run.
Calculus and optimization
The Hessian matrix explained, and the eigenvalue test for minima
How to compute the Hessian of a function by hand, why it is symmetric, and how its eigenvalues tell a minimum from a maximum or a saddle point, with PyTorch code to check each step.
What NLP is
How to learn NLP in 2026: a complete roadmap from text to LLMs
What to learn for natural language processing and in what order, from tokenization and word embeddings to transformers, LLMs and post-training, so you can see what is ahead and check off what you already know.
Calculus and optimization
Taylor series for machine learning: linearization and why gradient descent works
How to approximate a function near a point with its gradient and Hessian, how far you can trust that approximation, and what it says about why a small gradient descent step lowers the loss, with worked numbers and PyTorch code.
Calculus and optimization
The chain rule explained for machine learning
How to differentiate a function that feeds into another function, how the rule extends to several paths and to vector-valued layers, and how to check the result in PyTorch.
Calculus and optimization
Matrix calculus for deep learning: the gradient of a linear layer, by hand
A gentle walk through the few vector and matrix gradients deep learning reuses, with small examples you can check by hand, ending with the backward pass of a linear layer worked out with real numbers and checked in PyTorch.
Calculus and optimization
The Jacobian matrix explained
How to build the Jacobian of a function with several inputs and outputs, why the gradient is a one-row Jacobian, and how to use it to chain layers and estimate output sensitivity, with PyTorch checks.
Calculus and optimization
Derivatives for machine learning: limits, continuity, and the derivative
How the derivative is built from a limit, when a function has no derivative at a point (and why ReLU has a kink at 0), the seven rules that cover most expressions, and how to get the sigmoid's derivative in one line, with Python to check each result.
Linear algebra
Einsum explained with examples (torch.einsum)
How to read an einsum string like 'bik,bkj->bij', which letters get summed and which stay, and how to write the dot product, matrix multiplication, transpose, batched matmul, elementwise product, and outer product with torch.einsum.
Calculus and optimization
Partial derivatives and gradients explained
How to take the derivative of a function with several inputs one input at a time, how those derivatives stack into the gradient, and why stepping against the gradient lowers a loss fastest, with worked examples and PyTorch checks.
Linear algebra
Broadcasting in NumPy and PyTorch explained
How to tell in advance whether two shapes can be combined and what shape comes out, how to make a vector stretch across rows or across columns, and how to build a table of every pairwise difference without a loop, with PyTorch code for each.
Linear algebra
SVD explained: singular value decomposition and low-rank approximation
What the three factors of an SVD do to a vector, how to read a matrix's rank off its singular values, and how keeping only the largest few gives the closest possible low-rank copy of the matrix, with PyTorch code for each.
Linear algebra
What is a tensor? Shapes, batches, and tensor operations
How to read a tensor's shape, why models process a whole batch with one matrix multiplication, and when to use reshape, squeeze, sum and permute, with PyTorch code for each and the reshape mistake that silently scrambles attention heads.
Linear algebra
The condition number explained: why some problems are numerically unstable
How to compute the condition number of a matrix from its eigenvalues, what the Rayleigh quotient says about the largest and smallest eigenvalue, and two PyTorch experiments that show a large condition number amplifying small errors and slowing gradient descent.
Linear algebra
Cosine similarity explained: the angle between two vectors
How to compute cosine similarity by hand and in PyTorch, what scores of 1, 0 and -1 mean, and when to compare embeddings with it instead of the raw dot product.
Linear algebra
The dot product explained, and what it measures in machine learning
How to compute a dot product by hand, what its sign says about two vectors, how it relates to the angle between them, and the three PyTorch calls that compute it.
Linear algebra
Eigenvalues and eigenvectors explained
How to find the eigenvalues and eigenvectors of a matrix, how they relate to its determinant and trace, how a change of basis rewrites a vector or a matrix, and how eigendecomposition turns a matrix into per-axis scaling, with PyTorch code throughout.
Linear algebra
Invariance vs equivariance, and why convolution is translation equivariant
The two equations that separate an invariant function from an equivariant one, worked examples with rotations and shifts, which network layers have which property, and PyTorch checks you can run on a convolution, a pooling step, and a shuffled hidden layer.
Linear algebra
Least squares explained: linear regression as a projection, and the normal equation
How least squares becomes a projection onto a column space, how the normal equations come out of one orthogonality condition, what the Gram matrix is and when it fails, and how to fit a line in PyTorch.
Linear algebra
Orthogonality explained: orthogonal matrices, orthonormal bases, and projections
How to tell when two vectors or a whole matrix are orthogonal, why the inverse of an orthogonal matrix is its transpose, how to project one vector onto another, and how Gram-Schmidt builds an orthonormal basis, with PyTorch code for each.
Linear algebra
Positive definite matrices explained, with the Cholesky and QR factorizations
How to test whether a matrix is positive definite, semi-definite, negative definite or indefinite, why every covariance matrix passes the semi-definite test, and when to use the QR and Cholesky factorizations, with PyTorch code for each.
Linear algebra
Vector norms and distances: L1, L2, Euclidean vs Manhattan
How to compute the L1, L2 and L-infinity norms by hand, when Euclidean and Manhattan distance give different answers, why L1 and L2 penalties shrink weights differently, and the PyTorch calls for each.
Linear algebra
Determinant, trace and inverse: when a matrix is singular
How to compute a determinant for 2x2 and 3x3 matrices, what a zero determinant means for inverting a matrix and solving equations, why torch.linalg.solve beats torch.linalg.inv in code, and where the trace shows up.
Linear algebra
Solving systems of linear equations with Gaussian elimination
How to solve a 2x2 and a 3x3 system of equations by hand with row operations, how to tell from the reduced rows whether there is one solution, none, or infinitely many, and the same steps in PyTorch.
Linear algebra
Hadamard product vs matrix multiplication: * vs @ in PyTorch
The Hadamard product multiplies two matrices position by position, which is what * does in PyTorch, while matrix multiplication combines rows with columns, which is what @ does. This post compares the two on the same numbers, explains the shape rules for each, and shows where the Hadamard product is used in models.
Linear algebra
Matrix multiplication explained: the linear map view, dot products and outer products
Matrix multiplication combines two grids of numbers by pairing the rows of one with the columns of the other. This post explains how to compute it by hand, why the shapes have to line up, how a matrix transforms vectors, and two other ways to read the same product, with PyTorch code for each.
Linear algebra
Multicollinearity explained: why correlated features break linear regression
Multicollinearity is when two or more features in a dataset carry almost the same information. This post explains why that makes a linear model's weights unstable even when its predictions look fine, shows it happening in PyTorch, and covers what to do about it.
Linear algebra
Rank, column space and null space explained
How to find the rank of a matrix by hand, what the column space and null space say about whether Ax = b has a solution, why a large weight matrix can hold far fewer independent directions than its size, and how to check all of it in PyTorch.
Math toolkit and notation
Big-O notation for machine learning
Big-O notation describes how the work an algorithm does grows as its input gets bigger. This post explains what it keeps and what it drops, the growth rates you will meet (O(1), O(log n), O(n), O(n log n), O(n²)), and why an all-pairs method that is fine on a thousand items fails on a million.
Math toolkit and notation
Exponents and logarithms for machine learning
Logarithms show up in most machine learning loss functions because a log turns a product into a sum. This post covers the exponent and log rules, what an inverse function is, and why training works with log-likelihood instead of multiplying probabilities, with PyTorch code.
Math toolkit and notation
How to read the math notation in ML papers
Machine learning papers write their formulas with a small set of symbols: big sigma and pi, argmin and argmax, hats and bars over letters, a left arrow, and shape declarations like W ∈ ℝ^(m×n). This post explains what each one means and shows the PyTorch line that does the same thing.
Math toolkit and notation
Sine and cosine for machine learning
Sine and cosine are the coordinates of a point on a circle of radius 1, and they repeat every full turn. This post explains the unit circle, the identity sin² + cos² = 1, and how sine and cosine features let a model see that hour 23 and hour 0 are one hour apart, with PyTorch code.
Linear algebra
Span, basis and linear independence explained
The span of a set of vectors is every point you can reach by scaling and adding them, a basis is the smallest set that reaches a whole space, and linear independence says no vector in the set is redundant. This post explains all three with 2D examples, what they mean for features in a dataset, and how to check them in PyTorch.
Linear algebra
Vectors and matrices for machine learning
Machine learning stores data as scalars, vectors, matrices and tensors. This post explains each one, how shapes and indexing work in PyTorch, adding and scaling vectors, the transpose, and the identity, diagonal and symmetric matrices.
Evaluation
A step-by-step workflow for improving a machine learning model
When a model trains but its results are not good enough, a five-step loop tells you what to change next: pick a metric tied to the goal, build a small baseline, read the gap between training and test error, make one targeted change, and measure again.
Evaluation
ML model monitoring after deployment: data drift and when to retrain
A model that tested well can get worse after launch because the data it sees keeps changing while the model stays the same. This post explains how that happens, how to notice it, and how to retrain and replace a live model safely in PyTorch.
Evaluation
How to measure model size and speed: parameters, FLOPs, latency, throughput, memory
Accuracy says how good a model's predictions are, not whether it is small and fast enough to run. This post shows how to measure parameter count, FLOPs, latency, throughput, and memory in PyTorch, and which one to look at for which job.
Evaluation
How to choose an evaluation metric for your model
Accuracy, precision, recall, ROC AUC and R² each miss a different kind of failure. This post shows what each one misses, how to pick one primary metric from the cost of your model's mistakes, and which two or three metrics to track next to it.
Evaluation
Loss is NaN: the common causes and fixes
A loss that turns into NaN usually comes from a log of zero, an exponential that overflows, or a division by zero. This post shows how to catch the NaN on the step it appears, find the layer that produced it, and fix each common cause in PyTorch.
Evaluation
Regression metrics: MAE, RMSE, R², and MAPE
MAE, RMSE, R² and MAPE are the usual numbers for saying how good a model that predicts prices, sales or other quantities is. This post explains what each one measures, how to compute them in PyTorch, and which one to report for your problem.
Evaluation
Cross-validation explained: k-fold, stratified, and when not to use it
A score from one train/validation split can swing a lot depending on which examples landed where. This post explains k-fold and stratified k-fold cross-validation, builds both in plain PyTorch, and says when a single split or a time-ordered split is the better choice.
Evaluation
Data leakage in machine learning: examples and how to prevent it
A model that scores well during development can still fail on new data when its evaluation was contaminated. This post shows common examples of data leakage, how to spot it on a loss curve, and how to prevent it in PyTorch.
Generalization and regularization
Hyperparameter tuning: grid search vs random search
Picking the learning rate and layer sizes by trial and error wastes training runs. This post compares grid search, random search, and successive halving, with runnable PyTorch code and advice on which to use.
Evaluation
Precision, recall, and F1 score explained, with the confusion matrix
Precision, recall, and F1 score measure how well a classifier finds the cases you care about, which accuracy can hide. This post explains the confusion matrix they come from, what each metric tells you, how the decision threshold trades one for the other, and how to compute them in PyTorch.
Evaluation
ROC curve and AUC explained, and when to use PR AUC instead
The ROC curve and its AUC score tell you how well a classifier ranks positive examples above negative ones, without picking a threshold. This post explains how the curve is built, what an AUC of 0.5 or 0.9 means, why it can look good on rare-class data, and when to report PR AUC instead.
Generalization and regularization
Label smoothing explained
Label smoothing is a small change to classification training that stops a model from becoming 100% sure of its answers. This post explains what it changes in the targets, why that helps, how to set it in PyTorch, and when to leave it off.
Generalization and regularization
Weight decay vs L2 regularization: why they differ under Adam
Weight decay and L2 regularization both pull a model's weights toward zero, and with plain gradient descent they are the same thing. This post explains what each one does, why they stop being the same under Adam, and why AdamW is the usual fix.
Generalization and regularization
What is dropout and why does it work?
Dropout is a regularization technique that randomly switches off part of a neural network during training so the model does better on new data. This post explains what dropout does on each step, why it reduces overfitting, how it behaves at test time, and how to use it in PyTorch.
Generalization and regularization
The curse of dimensionality explained
The curse of dimensionality is what happens to a dataset when you add input features without adding examples. This post shows why the same data covers less of the input space with each new feature, why distances between examples stop being useful, and what to do about it.
Generalization and regularization
Double descent explained
Double descent is what happens when a model keeps growing after it can fit its training data exactly. Its error on new data rises to a peak and then falls a second time. This post explains where the peak sits, why very large models can do better than mid-sized ones, and how to reproduce the curve in a few lines of PyTorch.
Generalization and regularization
How much data do you need to train a model?
The amount of training data a model needs depends on how large the model is, how accurate it has to be, and how noisy the data is. This post explains that relationship, the formal version from learning theory, and a test that tells you whether more data would help your model.
Generalization and regularization
How to read a loss curve: training vs validation loss
A loss curve is a plot of a model's loss over the course of training. This post explains how to plot training and validation loss together, what a healthy curve looks like, and what it means when validation loss goes up while training loss keeps going down.
Optimization
How to make PyTorch training reproducible: seeds, determinism, and what still varies
Reproducible training means running the same code on the same data and getting the same result. This post explains where the randomness in a PyTorch run comes from, how to seed each source, how to seed a DataLoader, and which differences remain after seeding.
Optimization
How to save and resume training in PyTorch (checkpoints)
A checkpoint is a file that stores a training run so it can be continued later. This post explains what to put in one, how to save and load it in PyTorch, why saving only the model weights is not enough to resume, and why most runs keep a latest and a best checkpoint.
Optimization
Batch vs stochastic vs mini-batch gradient descent, and how to choose a batch size
Batch, stochastic, and mini-batch gradient descent differ only in how many training examples each update looks at. This post explains what that changes, why mini-batch is the usual choice, and how to pick a batch size and adjust the learning rate with it.
Optimization
Learning rate schedules explained: warmup, cosine annealing, step decay, and ReduceLROnPlateau
A learning rate schedule changes the step size of training as the run goes on, usually large at the start and small at the end. This post explains why a fixed learning rate falls short, how linear warmup, cosine annealing, step decay, and ReduceLROnPlateau work, and how to set each one up in PyTorch.
Optimization
Train, validation, and test sets: what each is for and how to split
A dataset is usually split into three parts: a training set the model learns from, a validation set for making choices, and a test set for the final score. This post explains what each split is for, why the test set is kept out of model choices, and how to split data in PyTorch.
Neural networks
Dying ReLU: what dead neurons are and how to fix them
A dead ReLU neuron outputs zero for every input and stops learning, and a network can lose a large share of its neurons this way during training. This post explains why ReLU neurons die, how to measure the dead fraction in PyTorch, and how to prevent it with initialization, the learning rate, and Leaky ReLU.
Neural networks
Vanishing and exploding gradients, and how gradient clipping helps
Vanishing and exploding gradients happen when the training signal shrinks to almost nothing or grows out of control as it passes back through a deep network. This post shows why both happen, how to measure them in PyTorch, and how ReLU, good initialization, and gradient clipping help.
Neural networks
Weight initialization explained: Xavier vs He (Kaiming) vs orthogonal
Weight initialization is how a neural network's weights are set before training starts, and a bad choice can stop a deep network from learning at all. This post shows what goes wrong with zero, too large, and too small weights, and when to use Xavier, He (Kaiming), or orthogonal initialization in PyTorch.
Neural networks
Parameters vs hyperparameters in machine learning
Parameters are the numbers a model learns from data, and hyperparameters are the settings you choose before training starts. This post explains the difference with a small PyTorch network, shows where each one lives in code, and how to pick hyperparameters with a validation set.
Neural networks
The universal approximation theorem explained (and what it does not promise)
The universal approximation theorem says a neural network with one wide enough hidden layer can match any continuous curve as closely as you like. This post explains what that means, why it works, and the four things the theorem does not promise about training and real data.
Neural networks
What is a neural network? The multilayer perceptron explained
A neural network passes its input through layers of simple units, each layer reshaping the numbers for the next one. This post explains the multilayer perceptron layer by layer, why stacking layers helps, and how to count its parameters by hand and in PyTorch.
How a model learns
Logistic regression explained: sigmoid, binary cross-entropy, and why it is a one-layer neural network
Logistic regression predicts the probability that an input belongs to one of two classes. This post explains the sigmoid function, the binary cross-entropy loss it trains with, why the two are paired, and how to train it in PyTorch.
How a model learns
Multi-class vs multi-label classification: softmax vs sigmoid outputs
Multi-class classification picks exactly one label per input, and multi-label classification can pick several or none. This post explains the difference, why the first uses softmax and the second uses one sigmoid per label, and how to write both in PyTorch.
How a model learns
Softmax explained: probabilities, model confidence, and the stable softmax trick
Softmax turns a classifier's raw scores into probabilities that add up to 1. This post explains the formula with a worked example, how to read its output as the model's confidence and when not to trust it, and why softmax code subtracts the largest score first.
How a model learns
Entropy, cross-entropy, and KL divergence explained
Cross-entropy is the usual loss for training a classifier. This post explains where it comes from, starting with entropy and ending with KL divergence, works each one out on the same small example, and shows how to compute them in PyTorch.
How a model learns
Maximum likelihood estimation explained: where MSE and cross-entropy come from
Maximum likelihood estimation picks the model parameters that make the observed data most probable. This post explains it with a coin-flip example, then shows how the same idea produces mean squared error for regression and cross-entropy for classification.
How a model learns
The PyTorch training loop explained, with Dataset and DataLoader
The training loop is the five lines of PyTorch code that make a model learn from data. This post explains what each line does, why their order can't be swapped, and how a Dataset and DataLoader feed the loop one batch at a time.
How a model learns
Linear regression from scratch in PyTorch
Linear regression predicts a number, like a house price, as a weighted sum of the inputs plus a bias. This post builds it in PyTorch two ways: with gradients computed by hand, and with nn.Linear and an optimizer.
How to learn ML
Learning ML with Python: the libraries you need (NumPy, pandas, scikit-learn, PyTorch) and what each is for
Four Python libraries come up when you start machine learning. This post explains what NumPy, pandas, scikit-learn and PyTorch each do, which one to learn first, and when you need the other three.
How a model learns
What is a perceptron? From the original perceptron to the modern neuron
A perceptron is the simplest artificial neuron: it weighs its inputs, adds them up, and outputs 0 or 1. This post explains how it works, how it learns, why modern neurons output a real number instead, and why one neuron can never solve XOR.
Interviews and careers
Machine learning interview questions for beginners, with answers
About 30 machine learning questions that come up in junior ML, data science, and ML engineering interviews, each with a short answer and the follow-up an interviewer usually asks next, grouped from data and evaluation through training, metrics, neural networks, and architectures.
How a model learns
What is machine learning? The 5 types of learning explained
Machine learning is a way to build software that learns its rules from examples instead of having them written by hand. This post explains how that works and why it can work on data the model has never seen, then walks through the five types of learning (supervised, unsupervised, semi-supervised, self-supervised, and reinforcement learning) with an example of each and how to pick between them.
Interviews and careers
How to choose a machine learning project
A good machine learning project usually starts from a problem you or someone close to you actually has. This post covers where to find one, the questions to ask before you start, and what a project needs to be worth showing: a baseline, more than one dataset, more than one model, and more than one way to evaluate it.
How a model learns
What is a loss function? MSE, cross-entropy, and when to use which
A loss function turns a model's predictions into one number that says how wrong they are, and training is the process of pushing that number down. This post explains why models need one, which loss to use for regression, binary, multi-class, and multi-label problems (and for a few other tasks), and how to use the loss on a proper validation split to evaluate a model.
Neural networks
Activation functions roadmap: step, sigmoid, tanh, ReLU, Leaky ReLU, GELU
An activation function is the small non-linear function each neuron applies to its output. This post goes through the common ones in the order they were invented, what each fixed, what each broke, and how to write every one in PyTorch.
Generalization and regularization
Bias-variance tradeoff explained with pictures
A model can be wrong on new data in two different ways, and the fixes for each pull in opposite directions. This post shows both with plots, how to tell them apart from your training and validation loss, and what to change for each.
Interviews and careers
What ML projects actually get you hired in 2026?
The machine learning projects that help in hiring are the ones you cared enough about to finish, measure, and defend. This post covers how to pick one, what a reviewer checks, five projects worth building, how to present it, and how to answer when an interviewer asks why you didn't do it another way.
Generalization and regularization
Regularization explained: L1, L2, dropout, and early stopping
Regularization is a set of techniques that stop a model from memorizing its training data so it does better on new data. This post explains four common ones (L2 weight decay, L1, dropout, and early stopping), how each one works, and how to set them in PyTorch.
How a model learns
What is backpropagation? Explained with a tiny network
Backpropagation is how a neural network works out which way to change each of its weights to reduce its error. This post computes it by hand on a network with two weights, shows why it runs backward, and checks the numbers against PyTorch.
How to learn ML
How much math do you actually need for machine learning?
You need enough math to read a loss function, an update rule, and a shape error, and that is a list you can finish in a few weeks. This post names every piece, says which ones you need before your first model and which can wait, and estimates the hours.
Optimization
Machine learning optimizers explained: SGD, momentum, RMSProp, Adam, AdamW
An optimizer is the rule that turns gradients into parameter updates. This post explains the five optimizers most models train with, in the order each one was invented to fix the last, and which one to pick.
Generalization and regularization
Overfitting vs underfitting: how to tell which one you have, and how to fix it
Overfitting is when a model memorizes its training data and fails on new data. Underfitting is when it cannot even fit the training data. This post shows how to read which one you have from the loss curves and what to change for each.
How to learn ML
How to learn machine learning effectively (and actually remember it)
Most people finish an ML course and cannot use it a month later. This post covers what to learn in which order, how to practice so the concepts stay, and a weekly schedule you can keep with 30 to 45 minutes a day.
Evaluation
My loss is not decreasing: a checklist
A training loss that stays flat usually has one of a short list of causes. This checklist goes through them in a practical order: the data, the training loop, the learning rate, the loss function, initialization, and a one-batch test that separates a bug from a hard problem.
Optimization
What is a learning rate, and how do you pick one?
The learning rate is the number that most often decides whether a model trains well. This post explains what it does inside the update rule, how to read the three shapes of a loss curve, why good values differ between SGD and Adam, and a five-line test that finds a usable value.
How a model learns
What is gradient descent? Explained step by step
Gradient descent is the procedure that trains almost every machine learning model. This post explains what it does, why the update has a minus sign, how the learning rate changes everything, and what the three lines of PyTorch that implement it are doing.
Optimization
What is the Adam optimizer? Explained step by step
Adam is the optimizer most deep learning models train with. This post explains what it does, why it works better than plain gradient descent, and when to use AdamW instead.
How to learn ML
How to learn machine learning in 2026: a complete roadmap for self-taught learners
The order to learn machine learning on your own: Python, the math that ML uses, PyTorch, then training and evaluating deep networks, with every concept named so you know exactly what is ahead of you.