Compactness
Closed and bounded sets trap sequences and force continuous functions to reach their minimum, which is why minimizers exist.
Why Does This Exist?
Optimizers promise to find a minimizer, but a continuous loss on an open or unbounded set need not have one: on the reals has infimum never attained, and on dives without bottom. Something must guarantee the bottom exists before algorithms chase it.
Compactness is that guarantee. In it means closed plus bounded. A continuous function on a compact set attains its minimum and maximum, and every sequence inside has a convergent subsequence staying inside.
This page states the finite-dimensional picture used in ML. Metric background is in metric spaces and convex structure in convex sets and functions.
The one idea you need first
Closed means containing all limit points; bounded means fitting inside some large ball. The interval is both. The interval is not closed, and is not bounded.
Think of It Like This
A fenced yard with no exits
Sheep wander the yard. Closed means the fence has no gaps: no sheep can stand at the boundary trickling out. Bounded means the fence exists at finite distance. Together the yard is compact.
Any infinite line of sheep has a cluster piling up somewhere inside the yard. That cluster is the convergent subsequence. Where the analogy stops: in infinite dimensions closed plus bounded is not enough; compactness needs a stronger finite-cover property.
How It Actually Works
Heine-Borel in : a set is compact exactly when it is closed and bounded. Bolzano-Weierstrass: every bounded sequence in has a convergent subsequence. Extreme value theorem: a continuous on compact attains and .
Finite subcover view: is compact when every open cover has a finite subcover. Three small discs can cover the ellipse in the diagram; infinitely many are never needed.
Worked example
Minimize on . Values: , , . Since is closed and bounded, a minimizer exists; calculus gives with value . On the open set the same point still works, but minimize on : values at dive toward no minimum because the endpoint is missing.
Watch Out For
Assuming compactness in infinite dimensions
Symptom: treating the unit ball of a function space as compact and claiming convergent subsequences of networks. Fix: in infinite dimensions closed unit balls are not compact; use weak topologies or explicit finite-dimensional sieves.
Optimizing over an unbounded set without coercivity
Symptom: loss drifts to infinity in parameter norm while values keep improving, so no minimizer exists. Fix: add a norm constraint to compactify, or prove the loss grows at infinity so sublevel sets are bounded.
The Quick Version
- In finite dimensions compact means closed plus bounded.
- Every sequence in a compact set has a convergent subsequence staying inside.
- Continuous functions on compact sets attain minima and maxima.
- on shows what fails without closedness: no bottom point.
- Constrain or prove boundedness before claiming a minimizer exists.