Series
AI basics
A series from the big-picture map of artificial intelligence down to individual algorithms. Every part can be read on its own — precise definitions for those who want them, plain explanations for everyone.
-
Syllabus
AI basics syllabus: from the fundamentals to language models and agents
A map of every article in the series — maths, search, machine learning, signal processing, neural networks, LSTM, transformers, generative models and AI agents.
-
Part 1
Map of artificial intelligence: what is what and how it all fits together
Artificial intelligence, machine learning, deep learning, language models and AI agents — how they relate to each other, on a single page. The opening part of the AI basics series.
-
Part 2
A brief history of artificial intelligence: from Turing to language models
The Turing test, the Dartmouth workshop, the golden years, two AI winters and expert systems, statistical learning, deep learning and language models — a timeline with links to parts of the series and the bitter lesson of seventy years of research.
-
Part 3
Data, model, training, inference: the basic terms on a single example
The whole machine learning path on estimating the price of a flat: data and how to split them, a model with parameters, training by gradient descent, hyperparameters and the learning rate, evaluation, inference and a glossary of terms with links to the parts of the series.
-
Part 4
How to read mathematical notation: symbols, indices, sums and quantifiers
A glossary of about forty symbols that lets you read every definition in the AI basics series — from indices and Greek letters through ∑ and argmin to ∀ and ∃. With a cheat sheet at the end.
-
Part 5
Sets and relations: the building blocks of definitions in AI
Sets, subsets, operations, the Cartesian product, relations, equivalence and orders — with Venn diagrams, a relation matrix and what all of it is good for in artificial intelligence.
-
Part 6
Functions and mappings: why every AI model is a function
Domain, image, injectivity, composition, inverses, functions of several variables and convexity — with graphs of the sigmoid, ReLU and a loss landscape.
-
Part 7
Logic and proofs: the rules AI reasons by
Propositions, connectives and truth tables, the implication trap, quantifiers and kinds of proof — and why XOR stopped the first neural networks.
-
Part 8
Graphs and trees: the structure that both search and neural networks stand on
Vertices and edges, degrees, the adjacency matrix, paths and components, BFS and Dijkstra, trees, the minimum spanning tree and the computation graph of a neuron — all on one graph with seven cities.
-
Part 9
Linear algebra for machine learning: vectors, matrices and why AI mostly multiplies
Vectors, the dot product and cosine similarity, matrices as transformations, the determinant, a neural network layer as Wx + b and eigenvectors — with figures computed by code.
-
Part 10
Derivatives, the gradient and the chain rule: how a model finds out which way to learn
The derivative as a rate of change, partial derivatives, the gradient and the chain rule — and backpropagation worked out number by number on a single neuron.
-
Part 11
Gradient descent: how a model learns
Learning rate, zigzag in narrow valleys, momentum, Adam, stochastic descent in mini-batches and local minima — with animations of real trajectories.
-
Part 12
What probability is: from rolling dice to the Kolmogorov axioms
Random experiment, sample space, events and operations on them, classical and frequency probability and the axioms everything else rests on — illustrated with two dice.
-
Part 13
Conditional probability and Bayes’ theorem: how to update your estimate when you learn something new
Conditional probability, the product rule, independence, the law of total probability and Bayes’ theorem — and why a positive test for a rare disease means only 16.7%.
-
Part 14
Random variables and the cumulative distribution function: one function that tells you everything about a distribution
What a random variable, its distribution and the cumulative distribution function are, how discrete and continuous variables differ and how to estimate the distribution function from data.
-
Part 15
Probability density and probability mass functions: why a continuous variable has zero probability at a point
The probability mass function, the probability density and the area under the curve — why density is not probability, why it can be greater than 1 and how a histogram estimates it from data.
-
Part 16
Expected value, variance and covariance: where a distribution lies, how wide it is and what goes with what
The expected value as a centre of mass, linearity, variance and standard deviation, Chebyshev's inequality, covariance and correlation — and why zero covariance does not yet mean independence.
-
Part 17
Overview of probability distributions: Bernoulli, binomial, Poisson, uniform, normal and exponential
The six most important distributions with their definitions, expected values and variances — the Galton board, the Poisson limit theorem, the 68–95–99.7 rule and when to use which distribution.
-
Part 18
Law of large numbers and central limit theorem: why averages behave so predictably
The sample mean, the law of large numbers and the central limit theorem with animations — why the normal distribution is everywhere, where the ±3% polling error comes from and why an estimate twice as precise costs four times as much data.
-
Part 19
Statistics and parameter estimation: maximum likelihood, MAP and confidence intervals
Samples, estimators, unbiasedness and why the sample variance divides by n − 1, maximum likelihood estimation, Bayesian MAP estimation and confidence intervals — and why training a neural network is parameter estimation.
-
Part 20
Information theory: entropy, cross-entropy and KL divergence — where loss functions come from
Information as surprise, entropy and the Huffman code, cross-entropy, KL divergence and information gain — and why the loss function of language models is cross-entropy.
-
Part 21
State-space search: BFS, DFS, UCS and A* with animations
AI basics made visual: what a state space is, how BFS, DFS, UCS, greedy search and A* work, what a heuristic is and how it all connects to machine learning.
-
Part 22
Games and adversaries: minimax, alpha-beta pruning and Monte Carlo tree search
A game as a search problem, the game tree, minimax, alpha-beta pruning, evaluation functions and MCTS — on tic-tac-toe, where everything can be computed, and the road from Deep Blue to AlphaZero.
-
Part 23
Constraint satisfaction: backtracking, constraint propagation and AC-3 on sudoku and a map of Czech regions
Variables, domains and constraints, the constraint graph, backtracking, the MRV and LCV heuristics, forward checking, AC-3 and min-conflicts — on colouring the regions of Czechia, sudoku and eight queens.
-
Part 24
Logic and knowledge systems: forward and backward chaining, resolution and expert systems
The knowledge base, entailment and model checking, Horn clauses, forward and backward chaining, resolution, Prolog and expert systems from MYCIN to knowledge graphs — on a small system that identifies an animal.
-
Part 25
Planning: STRIPS, the blocks world, heuristics from relaxation and planning in AI agents
The STRIPS and PDDL languages, forward and backward planning, the hmax and hadd heuristics, the Sussman anomaly, hierarchical planning and replanning — from the robot Shakey to AI agents that write themselves a to-do list.
-
Part 26
Local search and simulated annealing: a travelling salesman through the Czech regional capitals
The optimization problem, the travelling salesman problem, hill climbing with the 2-opt neighbourhood, local minima and restarts, simulated annealing, temperature and the cooling schedule — on a route through thirteen regional capitals with a known optimum.
-
Part 27
Genetic algorithms: population, crossover, mutation and selection on a backpack for a hike
Genome and fitness, tournament selection, one-point crossover, mutation and elitism, the schema theorem and premature convergence — on a knapsack problem with a known optimum, from the tent to FunSearch and AlphaEvolve.
-
Part 28
Evolution strategies and genetic programming: from the one-fifth rule to Kepler’s law
The (1+1)-ES and the one-fifth rule, populations and self-adaptation on the Rastrigin function, CMA-ES, programs as trees, symbolic regression that finds Kepler’s third law in planetary data, and program bloat.
-
Part 29
Ant colony optimization: how a pheromone trail finds a short path
Stigmergy, the double bridge experiment, Dorigo’s Ant System, the role of the parameters α, β and ρ, and improved variants — on a tour through the regional capitals and on 60 cities, compared with simulated annealing.
-
Part 30
Particle swarm optimisation: inertia, personal experience and the swarm’s experience
Boids and flocks, the PSO algorithm, the three components of velocity, a run on the Rastrigin function compared with an evolution strategy, the role of inertia, particle stability, swarm topology and the no free lunch theorem.
-
Part 31
Neuroevolution: evolving the weights and shape of neural networks, and the NEAT algorithm
Neurons and networks in a nutshell, evolving a controller for the cart-pole, why evolution instead of the gradient, XOR and hidden neurons, NEAT with historical markings and speciation, what happens without speciation, and successors from HyperNEAT to AmoebaNet.
-
Part 32
Fuzzy sets and membership functions: how to write down “somewhat warm”
The sharp boundary and the sorites paradox, fuzzy sets and the degree of membership, shapes of membership functions, the linguistic variable, support, core and α-cuts, Zadeh operations and the hedges “very” and “somewhat” — on temperature from cold to hot.
-
Part 33
Fuzzy logic and probability: why “somewhat warm” does not mean “probably warm”
Randomness and vagueness, Bezdek’s two bottles, the axioms of probability versus fuzzy membership, the Fréchet bounds, the probability of a fuzzy event on a weather forecast, and words for probability as fuzzy sets.
-
Part 34
Fuzzy logic: t-norms, implications and IF–THEN rules
Degrees of truth, t-norms and t-conorms (minimum, product, Łukasiewicz), which classical laws survive, residual implications and evaluating rules on a fan controlled by temperature and humidity.
-
Part 35
Fuzzy control: Mamdani and Sugeno from a fan to a pole on a cart
Controllers and feedback, fuzzification, inference and defuzzification, centroid, bisector and mean of maxima, the Takagi–Sugeno controller, control surfaces and a fuzzy controller that keeps a pole upright on a cart.
-
Part 36
Fuzzy clustering: the fuzzy c-means algorithm and points between clusters
K-means and its hard assignment, fuzzy c-means with memberships in all clusters, the fuzzifier m, the partition coefficient and the Xie–Beni index for choosing the number of clusters — and why outliers get high memberships.
-
Part 37
Neuro-fuzzy systems (ANFIS): fuzzy rules that learn from data
A Sugeno fuzzy system as a five-layer network, hybrid learning with least squares and gradient, learning a function from noisy data, choosing the number of rules and overfitting, the readability of learned rules and the link to RBF networks.
-
Part 38
Markov chains: the transition matrix, the stationary distribution and PageRank
The Markov property, the transition matrix and the evolution of a distribution in a weather model, the stationary distribution and the ergodic theorem, Markov’s analysis of vowels applied to Mácha’s Máj, PageRank and text generation.
-
Part 39
Hidden Markov models: the Viterbi algorithm and the dishonest casino
Hidden Markov model, Rabiner’s three problems, the forward algorithm, the Viterbi algorithm, posterior decoding and the Baum–Welch algorithm — on a casino that now and then secretly swaps the die for a loaded one.
-
Part 40
Bayesian networks: why the grass is wet and what it means for the sprinkler
Joint distribution and its factorisation, Bayesian network and conditional probability tables, inference by enumeration, explaining away, d-separation and approximate inference by sampling — on the network cloudy, sprinkler, rain, wet grass.
-
Part 41
The Kalman filter: how to estimate where a car is and how fast it goes from imprecise measurements
Combining two measurements and the Kalman gain, the filter as a running average, the state-space model, prediction and correction, tracking a car from GPS with an estimate of the unmeasured velocity, tuning the noises Q and R, optimality and nonlinear extensions.
-
Part 42
Types of machine learning: supervised, unsupervised, semi-supervised and more
Supervised, unsupervised, semi-supervised, self-supervised and reinforcement learning — with precise definitions, plain-language explanations and animations of real algorithms.
-
Part 43
Prompts, context and RAG: how to give a model the right information
The prompt and the context window, RAG step by step, BM25 search written from scratch over the articles of this website, inflection and stems, questions in other words, chunk size, assembling the prompt and prompt injection.
-
Part 44
Variational autoencoders (VAE): new images from a continuous latent space
A generative model with a latent variable, a VAE written from scratch with the reparameterization trick, an ordered latent space, generating digits from noise compared with an ordinary autoencoder, the effect of β and collapse, interpolation, and where VAEs are used.
-
Part 45
Generative adversarial networks (GAN): the forger versus the detective
The game of generator and discriminator, a GAN written from scratch, the non-saturating loss, eight clusters on a circle and mode collapse, digits sharper than with a VAE but not all of them, and the road from GANs to diffusion models.
-
Part 46
Diffusion models: how pure noise becomes an image
The forward process of adding noise, a network that estimates the noise, DDPM and DDIM written from scratch, eight clusters without mode collapse, how many sampling steps are needed, a comparison with VAE and GAN on digits and the road to images from text.
-
Part 47
Markov decision processes: states, actions, rewards and the Bellman equations
An MDP on a grid world with a cliff, return and discount, the value function and the Bellman equation, value iteration and policy iteration written from scratch, how the discount, slipping and step cost change optimal behaviour, and a check by simulation.
-
Part 48
Q-learning and DQN: learning the value of actions, from a table to a neural network
Temporal-difference learning, Q-learning and SARSA on cliff walking, ε-greedy exploration, on-policy and off-policy, DQN with experience replay and a target network on the cart-pole written from scratch, and why DQN learning falls apart so easily.
-
Part 49
Policy gradient and PPO: learning the policy directly
A stochastic policy as a network, REINFORCE and the policy gradient theorem, the baseline and the advantage, actor-critic, PPO with clipping written from scratch on the cart-pole, what happens without clipping, and how PPO fine-tuned language models.
-
Part 50
How an AI agent works: a language model in a loop with tools
The reasoning – tool call – result loop on a real task over the articles of this website, three approaches and their cost in tokens, why the context grows, plan and memory, the reliability of long tasks with and without checking, and why an agent needs approval.
-
Part 51
Programming with AI agents: the task, tests and review
How to write a task for an agent with acceptance criteria, why to work in small steps, an experiment with mutation testing (how many bugs happy-path tests, edge cases and property-based tests detect), who should write the tests and what to watch out for.
-
Part 52
Evaluating and securing AI systems: how to measure and how to keep watch
Benchmarks and measurement uncertainty, how selecting on a test set inflates results, data contamination in an experiment, kinds of risk, an agent's command filter as a denylist versus an allowlist, and defence in depth.