Train the same network twice from different random seeds, and the two sets of weights look nothing alike. Part of that difference is an illusion. Take a single hidden layer with 1,000 units and shuffle the units, carrying each unit's incoming and outgoing weights along with it. There are \( 1000! \approx 4 \times 10^{2567} \) ways to do this, and every one of them computes exactly the same function. That number has 2,568 digits; the number of atoms in the observable universe has about 80.

Explaining why takes no advanced mathematics: only sets, maps, and the question of when two different inputs can produce the same output. The review behind this series starts in exactly the same place.

Geometric deep learning (GDL) designs neural networks around the symmetries of their data. Convolutions do this for images, message passing for graphs, and equivariant layers for molecules and point clouds (Bronstein et al. 2021). The mathematics behind it spans group theory, differential geometry, functional analysis and spectral graph theory. Sáez de Ocáriz Borde & Bronstein (2025) collect all of it into a single 78-page review.

This series, Math for GDL, works through that review one section at a time. It covers the mathematics only; the architectures built on it will get a separate GDL series. I'm writing these notes as I learn the material, so they assume only some linear algebra and Python. Every equation comes with a numerical check in an accompanying notebook.

Part 1 covers §1.1: sets, maps, composition, and the hypothesis class. Nothing here is geometric yet. What the section does give us is a precise picture of three things: what a neural network is, what training does, and what GDL changes. Fig. 1 is that picture. By the end of the post, every label in it will be defined.

Overview diagram. Two parameter vectors, theta and theta prime, both map to the same learned map inside the hypothesis class F. F sits inside the set of all maps from X to Y. The target f-star lies outside F. The distance from the target to the best member of F is the approximation error; the distance from the best member to the learned map is the estimation error. A dashed region inside F marks the symmetric maps of Part 2. parameters Θ all maps 𝒳 → 𝒴, the set 𝒴𝒳 hypothesis class ℱ ℱG (Part 2) θ ↦ fθ θ θ′ target f* approximationerror best in ℱ estimation error learned map
Fig. 1. The whole post in one picture. A parametrization sends each parameter vector \( \theta \) to a map \( f_\theta \). The maps it reaches form the hypothesis class \( \mathcal{F} \), a region inside the set \( \mathcal{Y}^{\mathcal{X}} \) of all maps \( \mathcal{X} \to \mathcal{Y} \). Different parameters can reach the same map (two arrows, one endpoint). Training on data lands on a learned map \( \hat{f} = f_{\hat{\theta}} \). Its distance from the target \( f^* \) has two parts: the approximation error (how close \( \mathcal{F} \) can get at best) and the estimation error (how far training lands from that best member). GDL restricts the search to the symmetric maps \( \mathcal{F}_G \) (dashed), the subject of Part 2.
Table of contents
  1. Notation
  2. Sets
  3. Maps
    1. Injective, surjective, bijective
  4. Composition
  5. Cartesian products and datasets
  6. The hypothesis class
    1. The parametrization is not injective
    2. The size trade-off
    3. Where geometric deep learning comes in
  7. Quick summary
  8. Open questions
  9. Code
  10. Citation
  11. References

Notation

SymbolMeaning
\( x \in A \)\( x \) is an element of the set \( A \)
\( A \subseteq B \)\( A \) is a subset of \( B \)
\( |A| \)Cardinality: the number of elements of a finite set \( A \)
\( \mathcal{X}, \mathcal{Y} \)Input set and output (label) set
\( f : \mathcal{X} \to \mathcal{Y} \)A map with domain \( \mathcal{X} \) and codomain \( \mathcal{Y} \)
\( f(\mathcal{X}) \)The image of \( f \): the values it actually attains
\( g \circ f \)Composition: apply \( f \), then \( g \)
\( \mathcal{X} \times \mathcal{Y} \)Cartesian product: all ordered pairs \( (x, y) \)
\( \Gamma_f \)The graph of \( f \): the pairs \( (x, f(x)) \)
\( \mathcal{D} \)A dataset: a finite sequence of pairs in \( \mathcal{X} \times \mathcal{Y} \)
\( W^{(k)}, b^{(k)} \)Weight matrix and bias vector of layer \( k \)
\( \Theta \)Parameter space, e.g. \( \mathbb{R}^p \) for \( p \) weights and biases
\( \mathcal{Y}^{\mathcal{X}} \)The set of all maps \( \mathcal{X} \to \mathcal{Y} \)
\( \mathcal{F} \)Hypothesis class, a subset of \( \mathcal{Y}^{\mathcal{X}} \), often \( \{ f_\theta \mid \theta \in \Theta \} \)
\( \ell \)Loss function

Sets

Comfortable with sets and functions? Skim the definitions, read the weather-station example (it returns in every part), and pick up again at The hypothesis class.

Definition 1 (Set). A set is a collection of distinct objects, called its elements. The order in which elements are listed does not matter, and listing an element twice changes nothing: \( \{a, b\} = \{b, a\} \) and \( \{a, a\} = \{a\} \). We write \( x \in A \) if \( x \) is an element of \( A \), and \( x \notin A \) otherwise.

Aside: can a set be defined at all?

Definition 1 leans on the word collection, which is no more precise than set. That is unavoidable. The standard foundation of mathematics is Zermelo–Fraenkel set theory with the axiom of choice (ZFC), and there, sets and the membership relation \( \in \) are primitive notions. The axioms say how sets behave without saying what they are, much as Hilbert's axioms for geometry leave points and lines undefined. The naive definition above is the one the review uses, and it is all this series needs.

Membership is the only structure a set carries: there is no ordering, no distance, and no notion of two elements being close. Throughout the series we use a running example of four weather stations:

$$ \mathcal{S} = \{\text{aachen},\ \text{berlin},\ \text{cologne},\ \text{dresden}\}. $$

As a set, \( \mathcal{S} \) does not encode that Aachen and Cologne are neighbours while Dresden lies at the other end of the country. You can read much of the review, and this series, as adding structure to a bare set like this, one kind at a time:

  • Groups (§1.2, Part 2) add symmetry: transformations that leave something unchanged.
  • Vector spaces, norms and inner products (§1.3, §2, Part 3) let us add and scale elements, then measure length and angle.
  • Metrics (§2.2, also Part 3) add distance.
  • Topology and manifolds (§4, Parts 5 and 6) add nearness and smoothness without requiring global coordinates.
  • Graphs (§7, Part 8) add explicit neighbourhood relations, such as which stations are adjacent.

You can specify a set by listing its elements, as above, or with set-builder notation, which states a condition for membership. The vertical bar reads such that:

$$ T = \{\, t \in \mathbb{R} \mid -30 < t < 50 \,\}. $$

Here \( T \) is the set of real numbers strictly between −30 and 50, a plausible range of air temperatures in °C. Two more notions come up constantly:

Definition 2 (Subset, cardinality). A set \( A \) is a subset of a set \( B \), written \( A \subseteq B \), if every element of \( A \) is also an element of \( B \). The cardinality \( |A| \) of a finite set \( A \) is its number of elements.

For example, \( \{\text{aachen}, \text{cologne}\} \subseteq \mathcal{S} \) and \( |\mathcal{S}| = 4 \). The review also defines union, intersection, difference, complement, power sets and cardinality for infinite sets; later posts introduce those when they are needed.

Why ML cares. A set's lack of order is not pedantry. A 3D point cloud is a set of points, and the atoms of a molecule or the nodes of a graph have no natural first element either. A network that reads such data as an ordered list can give different answers for the same object listed in a different order. PointNet (Qi et al. 2017) avoids this by combining per-point features with max pooling, which ignores order. Deep Sets (Zaheer et al. 2017) went further. For sets drawn from a countable universe, they proved that every order-independent function can be written as \( \rho\big(\sum_{a \in A} \phi(a)\big) \) for suitable maps \( \phi \) and \( \rho \). Order-independence is the first of the symmetries that Part 2 makes precise.

Maps

Definition 3 (Map). Let \( \mathcal{X} \) and \( \mathcal{Y} \) be sets. A map \( f : \mathcal{X} \to \mathcal{Y} \) is a rule that assigns to each element \( x \in \mathcal{X} \) exactly one element \( f(x) \in \mathcal{Y} \). The set \( \mathcal{X} \) is the domain of \( f \) and \( \mathcal{Y} \) is its codomain. We write \( x \mapsto f(x) \) for the action of \( f \) on a single element.

Definition 4 (Image). The image of a map \( f : \mathcal{X} \to \mathcal{Y} \) is the set of values it attains, $$ f(\mathcal{X}) = \{\, f(x) \mid x \in \mathcal{X} \,\} \subseteq \mathcal{Y}. $$

Both clauses of Definition 3 matter: every input gets an output, and no input gets two. A day of temperature readings is a map \( \mathcal{S} \to \mathbb{R} \); an image classifier is a map from the set of images to the set of class labels.

Aside: terminology differences from the review

The review reserves the word function for maps into a set of numbers such as \( \mathbb{R} \), but most machine learning texts, this one included, use the two words interchangeably. The review also uses image for a single value: \( f(x) \) is the image of \( x \). For the whole set of values, which Definition 4 calls the image of \( f \), it writes \( \operatorname{ran} f \) (the range).

The codomain is part of how a map is declared; the image depends on its values. The two need not coincide (Fig. 2).

A map from four stations to the codomain warm, cold, mild. Aachen and Cologne map to warm, Berlin and Dresden to cold. Mild is never reached. image aachen berlin cologne dresden warm cold mild 𝒮 (domain) codomain
Fig. 2. A labelling map from the four stations to the codomain {warm, cold, mild}. Each station has exactly one outgoing arrow, as the definition requires. The image (dashed) is {warm, cold}: mild belongs to the codomain but is never attained, so the map is not surjective. Two stations share each label, so it is not injective either.

Injective, surjective, bijective

Definition 5 (Injective, surjective, bijective). Let \( f : \mathcal{X} \to \mathcal{Y} \) be a map.

  1. \( f \) is injective (one-to-one) if for all \( x_1, x_2 \in \mathcal{X} \), \( f(x_1) = f(x_2) \) implies \( x_1 = x_2 \).
  2. \( f \) is surjective (onto) if for every \( y \in \mathcal{Y} \) there exists \( x \in \mathcal{X} \) with \( f(x) = y \); equivalently, \( f(\mathcal{X}) = \mathcal{Y} \).
  3. \( f \) is bijective if it is both injective and surjective.

In words, an injective map never sends two inputs to the same output, and a surjective map reaches every element of its codomain. A bijection pairs the two sets up exactly, so it can be undone: it has an inverse \( f^{-1} : \mathcal{Y} \to \mathcal{X} \) with \( f^{-1}(f(x)) = x \) for all \( x \in \mathcal{X} \) and \( f(f^{-1}(y)) = y \) for all \( y \in \mathcal{Y} \). The map in Fig. 2 is neither injective nor surjective.

Why ML cares. Normalizing flows depend on bijectivity. A flow generates data by pushing simple random noise \( z \) through a bijection, \( x = f(z) \). Because \( f \) can be undone, every data point comes from exactly one noise vector, \( z = f^{-1}(x) \). That lets the change-of-variables formula compute the probability of \( x \) exactly. RealNVP (Dinh et al. 2017) builds \( f \) from layers designed to be bijective, with an inverse that is cheap to compute. An ordinary ReLU network would not work here: as an aside below explains, it is typically not even injective.

On finite sets each property can be checked by enumeration. Representing a map as a Python dict:

from itertools import product

STATIONS = {"aachen", "berlin", "cologne", "dresden"}

def is_injective(f):
    return len(set(f.values())) == len(f)

def is_surjective(f, codomain):
    return set(f.values()) == set(codomain)

label = {"aachen": "warm", "berlin": "cold",
         "cologne": "warm", "dresden": "cold"}

assert not is_injective(label)                 # aachen and cologne collide
assert is_surjective(label, {"cold", "warm"})  # both labels are used

# pigeonhole: every one of the 2**4 possible labelings fails injectivity
for values in product(["cold", "warm"], repeat=4):
    assert not is_injective(dict(zip(sorted(STATIONS), values)))

Two details matter here. First, compare the second assertion with Fig. 2. The code declares the codomain {cold, warm}, and with that codomain the assignment is surjective. Fig. 2 declares {warm, cold, mild}, and there the same assignment is not. The values are identical; only the declared codomain differs. That is why is_surjective has to take the codomain as an argument: the image can be computed from the map's values, but the codomain cannot.

Second, the loop checks one instance of the pigeonhole principle: put more pigeons than holes, and some hole gets at least two. So an injection between finite sets requires \( |\mathcal{X}| \le |\mathcal{Y}| \), and no map from four stations to two labels can be injective.

Composition

Definition 6 (Composition). Let \( f : \mathcal{X} \to \mathcal{Y} \) and \( g : \mathcal{Y} \to \mathcal{Z} \) be maps. Their composition is the map \( g \circ f : \mathcal{X} \to \mathcal{Z} \) defined by $$ (g \circ f)(x) = g\big(f(x)\big) \quad \text{for all } x \in \mathcal{X}. $$

Composition requires the codomain of \( f \) to match the domain of \( g \), and \( g \circ f \) reads right to left: \( f \) is applied first. It is not commutative; in general \( g \circ f \neq f \circ g \), and one side may not even be defined. It is, however, associative:

Proposition 1 (Associativity). For maps \( f : \mathcal{X} \to \mathcal{Y} \), \( g : \mathcal{Y} \to \mathcal{Z} \) and \( h : \mathcal{Z} \to \mathcal{W} \), $$ h \circ (g \circ f) = (h \circ g) \circ f. $$

Proof

Both sides are maps \( \mathcal{X} \to \mathcal{W} \). For every \( x \in \mathcal{X} \), $$ \begin{aligned} \big(h \circ (g \circ f)\big)(x) &= h\big((g \circ f)(x)\big) && \text{; Definition 6} \\ &= h\big(g(f(x))\big) && \text{; Definition 6 again} \\ &= (h \circ g)\big(f(x)\big) && \text{; read backwards} \\ &= \big((h \circ g) \circ f\big)(x). \end{aligned} $$ Two maps with the same domain and codomain that agree at every point are equal. ∎

Composition also preserves the properties in Definition 5. The review states this without proof; the proof is short enough to include.

Proposition 2. Let \( f : \mathcal{X} \to \mathcal{Y} \) and \( g : \mathcal{Y} \to \mathcal{Z} \). If \( f \) and \( g \) are both injective, so is \( g \circ f \). If both are surjective, so is \( g \circ f \). Hence if both are bijective, so is \( g \circ f \).

Proof

Injective: follow two inputs back through the layers. $$ \begin{aligned} g(f(x_1)) = g(f(x_2)) &\;\Rightarrow\; f(x_1) = f(x_2) && \text{; } g \text{ injective} \\ &\;\Rightarrow\; x_1 = x_2 && \text{; } f \text{ injective} \end{aligned} $$ Surjective: given \( z \in \mathcal{Z} \), choose \( y \in \mathcal{Y} \) with \( g(y) = z \) (\( g \) is surjective), then \( x \in \mathcal{X} \) with \( f(x) = y \) (\( f \) is surjective). Now \( (g \circ f)(x) = g(y) = z \). ∎

A feed-forward network with \( L \) layers is exactly such a composition,

$$ f = f_L \circ f_{L-1} \circ \cdots \circ f_1, \qquad f_k(h) = \sigma\big(W^{(k)} h + b^{(k)}\big). $$

Each layer \( f_k \) does two things. It first applies an affine map \( h \mapsto W^{(k)} h + b^{(k)} \), a matrix multiplication followed by a shift. It then applies a nonlinearity \( \sigma \) to each coordinate separately (the last layer usually skips this step). Composition makes the whole network a single map \( \mathcal{X} \to \mathcal{Y} \). Associativity adds that we can group the layers however we like, for instance into blocks, without changing that map. A two-layer example:

import numpy as np

rng = np.random.default_rng(11)
W1, b1 = rng.normal(size=(3, 2)), rng.normal(size=3)
W2, b2 = rng.normal(size=(1, 3)), rng.normal(size=1)

f1 = lambda x: np.maximum(W1 @ x + b1, 0.0)   # f1 : R^2 -> R^3 (ReLU layer)
f2 = lambda h: W2 @ h + b2                    # f2 : R^3 -> R^1 (linear output)

def compose(g, f):
    return lambda x: g(f(x))

network = compose(f2, f1)
x = rng.normal(size=2)
assert np.allclose(network(x), f2(f1(x)))     # composition is nesting

f3 = lambda y: np.tanh(y)                     # associativity
assert np.allclose(compose(compose(f3, f2), f1)(x),
                   compose(f3, compose(f2, f1))(x))

Composing in the wrong order, compose(f1, f2), asks for \( f_1 \circ f_2 \), which is undefined: \( f_2 \) outputs vectors in \( \mathbb{R}^1 \), but \( f_1 \) expects \( \mathbb{R}^2 \). Python only notices when you call the composite. Give it a valid input for \( f_2 \) (any vector in \( \mathbb{R}^3 \)), and the matrix multiplication inside \( f_1 \) fails with a shape error.

Aside: are neural networks injective?

The review remarks that neural networks are generally not bijective. Injectivity is the easy one to lose. A ReLU layer \( h \mapsto \max(Wh + b, 0) \) outputs 0 for every unit whose pre-activation, the value before the ReLU, is negative. Where fewer units are active than there are input dimensions, the layer squeezes its input into fewer directions than it started with, so different inputs land on the same output. (Wide enough layers can avoid this: from \( \max(x, 0) \) and \( \max(-x, 0) \) you can recover \( x \) exactly.) And if the first layer \( f_1 \) is not injective, neither is the network. Two inputs merged by \( f_1 \) stay merged by every later layer.

Cartesian products and datasets

Definition 7 (Cartesian product). The Cartesian product of sets \( \mathcal{X} \) and \( \mathcal{Y} \) is the set of ordered pairs $$ \mathcal{X} \times \mathcal{Y} = \{\, (x, y) \mid x \in \mathcal{X},\ y \in \mathcal{Y} \,\}, $$ where \( (x, y) = (x', y') \) if and only if \( x = x' \) and \( y = y' \).

Unlike a set, a pair is ordered: \( (\text{berlin}, \text{cold}) \) and \( (\text{cold}, \text{berlin}) \) are different objects. For finite sets \( |\mathcal{X} \times \mathcal{Y}| = |\mathcal{X}|\,|\mathcal{Y}| \), so four stations and two labels give eight pairs. A supervised dataset of \( n \) examples is a finite sequence of such pairs,

$$ \mathcal{D} = \big( (x_1, y_1), \ldots, (x_n, y_n) \big), \qquad (x_i, y_i) \in \mathcal{X} \times \mathcal{Y}. $$

We use a sequence rather than a set because a repeated example should count twice, and a set would merge the copies. Without repeats, \( \mathcal{D} \) can be viewed as a subset of \( \mathcal{X} \times \mathcal{Y} \). (Collections that allow repeats are called multisets; they return with graph neural networks.)

Definition 8 (Graph). The graph of a map \( f : \mathcal{X} \to \mathcal{Y} \) is the set $$ \Gamma_f = \{\, (x, f(x)) \mid x \in \mathcal{X} \,\} \subseteq \mathcal{X} \times \mathcal{Y}. $$

A warning about the word. This graph is the one you draw when you plot a function. It has nothing to do with the graphs of nodes and edges in §7, which appear throughout geometric deep learning. Both meanings are standard, so context has to tell them apart.

Aside: what a map is, formally

The graph is also how set theory makes the word rule in Definition 3 precise. In one common convention, a map from \( \mathcal{X} \) to \( \mathcal{Y} \) is a subset \( \Gamma \subseteq \mathcal{X} \times \mathcal{Y} \) together with the declared codomain \( \mathcal{Y} \). The only requirement is that every \( x \in \mathcal{X} \) is the first entry of exactly one pair in \( \Gamma \). (Many texts, the review's margin notes included, identify a map with its graph alone.) The graph determines the image but not the codomain, which is the formal reason is_surjective had to be told the codomain separately.

A dataset without repeated inputs or conflicting labels gives each training input exactly one label. So it defines a map, but only on the training inputs: a partial map from \( \mathcal{X} \) to \( \mathcal{Y} \). Learning means choosing a map defined on all of \( \mathcal{X} \) that approximately agrees with it. Exact agreement is often impossible (no line passes through five points sampled from a curve) and usually undesirable when the labels are noisy. When the hypothesis class does contain exact extensions, it is the class that decides which one we get.

The hypothesis class

Definition 9 (Hypothesis class). Let \( \mathcal{Y}^{\mathcal{X}} \) denote the set of all maps \( \mathcal{X} \to \mathcal{Y} \). A hypothesis class is any subset \( \mathcal{F} \subseteq \mathcal{Y}^{\mathcal{X}} \). Its elements are called hypotheses, and a learning algorithm chooses one of them as its prediction rule.

The notation \( \mathcal{Y}^{\mathcal{X}} \) comes from counting: for finite sets \( |\mathcal{Y}^{\mathcal{X}}| = |\mathcal{Y}|^{|\mathcal{X}|} \). The \( 2^4 = 16 \) labellings enumerated in the injectivity check above are exactly the elements of \( \{\text{cold}, \text{warm}\}^{\mathcal{S}} \).

Definition 9 allows any subset, but in deep learning \( \mathcal{F} \) is almost always parametrized. There is a parameter set \( \Theta \) and a map \( \theta \mapsto f_\theta \) from \( \Theta \) to \( \mathcal{Y}^{\mathcal{X}} \). It is an unusual-looking map, because its outputs are themselves maps. The hypothesis class is its image (Definition 4):

$$ \mathcal{F} = \{\, f_\theta \mid \theta \in \Theta \,\}. $$

Linear regression is the simplest case, with \( \theta = (w, b) \) and \( f_\theta(x) = w^\top x + b \). For a neural network, \( \Theta = \mathbb{R}^p \) collects all \( p \) weights and biases, and choosing an architecture (depth, widths, nonlinearities) fixes \( \mathcal{F} \). Training selects one member, ideally by empirical risk minimization over the dataset (Shalev-Shwartz & Ben-David 2014):

$$ \hat{\theta} \in \operatorname*{arg\,min}_{\theta \in \Theta} \; \frac{1}{n} \sum_{i=1}^{n} \ell\big(f_\theta(x_i),\, y_i\big). $$

Here \( \ell \) is a loss function measuring how wrong one prediction is, and \( \operatorname{arg\,min} \) is the set of parameters at which the average loss is smallest. It is written with \( \in \) rather than \( = \) because there can be several minimizers. In practice gradient descent only approximates this; the review covers losses and gradient descent in §3.7. The division of labour is the main point of this post: the architecture chooses a set of maps, and training chooses one element of it.

The parametrization is not injective

Is the parametrization \( \theta \mapsto f_\theta \) surjective? That depends on the codomain we declare, just as in Fig. 2. As a map into \( \mathcal{Y}^{\mathcal{X}} \) it is usually not, since most maps \( \mathcal{X} \to \mathcal{Y} \) are not networks of the chosen shape. As a map into \( \mathcal{F} \) it is surjective by definition, since \( \mathcal{F} \) is its image.

Either way, it is far from injective (Definition 5). Permuting the hidden units of a layer, which means reordering the rows of \( W^{(1)} \) and \( b^{(1)} \) together with the columns of \( W^{(2)} \), changes \( \theta \) but leaves \( f_\theta \) unchanged:

perm = np.array([2, 0, 1])
f1_perm = lambda x: np.maximum(W1[perm] @ x + b1[perm], 0.0)
f2_perm = lambda h: W2[:, perm] @ h + b2
network_perm = compose(f2_perm, f1_perm)

assert not np.allclose(W1[perm], W1)              # different parameters...
assert np.allclose(network(x), network_perm(x))   # ...same function
                                                  # (the notebook tries 100 inputs)

A hidden layer of width \( k \) admits \( k! \) such permutations; the \( 1000! \) from the opening is the case \( k = 1000 \). A network with hidden layers of widths \( k_1, \ldots, k_m \) admits \( k_1! \cdots k_m! \). Together, these permutations form what Part 2 will call a group acting on \( \Theta \). They are the first symmetry in this series.

Permutations give only finitely many duplicates of each \( \theta \); ReLU networks have infinitely many. Scale one hidden unit's incoming weights and bias by some \( c > 0 \), and its outgoing weight by \( 1/c \). Write the unit's incoming weights as the row \( a^\top \) of \( W^{(1)} \), its bias as \( b \), and its outgoing weight as \( w \). A positive factor passes through ReLU, \( \max(cz, 0) = c \max(z, 0) \) for \( c > 0 \), so the unit's contribution to the output does not change: $$ \begin{aligned} \textcolor{#e0453a}{\tfrac{1}{c}}\, w \max\big(\textcolor{#3b82f6}{c}\,(a^\top x + b),\, 0\big) &= \textcolor{#e0453a}{\tfrac{1}{c}}\, w \cdot \textcolor{#3b82f6}{c} \max(a^\top x + b,\, 0) && \text{; } c \text{ factors out} \\ &= w \max(a^\top x + b,\, 0) && \text{; } \tfrac{1}{c} \cdot c = 1 \end{aligned} $$ Every \( c > 0 \) gives another \( \theta \) with the same \( f_\theta \). The notebook checks both kinds of duplicate.

Why ML cares. These duplicates explain a puzzle from practice. Average the weights of two independently trained networks and the result usually performs badly, even when both originals are good. Entezari et al. (2022) conjectured that much of the problem is that the two networks list their hidden units in different orders. Ainsworth et al. (2023) gave algorithms that permute one network's units to line up with the other's. After this alignment, they found, wide enough networks (ResNets on CIFAR-10, for instance) can be averaged with essentially no loss in accuracy. Model merging works because \( \theta \mapsto f_\theta \) is not injective.

Aside: how large can a hypothesis class be?

A fixed architecture fixes \( \mathcal{F} \). Now take the union of the one-hidden-layer classes over all widths. The result can approximate any continuous function on a compact subset of \( \mathbb{R}^d \) to any accuracy. (Compact means closed and bounded, like the cube \( [0, 1]^d \).) The approximation is uniform: it holds at every point of the set at once. This universal approximation property was proved for sigmoidal activations by Cybenko (1989) and for general squashing functions by Hornik et al. (1989). Leshno et al. (1993) extended it to every non-polynomial activation that satisfies mild regularity conditions, a class that includes ReLU. Expressiveness is therefore rarely the bottleneck. The harder question is which member of \( \mathcal{F} \) the data leads us to.

The size trade-off

§1.1 closes with the central tension. Call the member of \( \mathcal{F} \) closest to the target function its best member. Enlarging the class can only help the best member: if \( \mathcal{F} \subseteq \mathcal{F}' \), the best member of \( \mathcal{F}' \) is at least as good. But finding it from finite, noisy data gets harder. Shalev-Shwartz & Ben-David (2014) call this the approximation–estimation trade-off. The review describes it as related to the bias–variance trade-off (Geman et al. 1992), which splits the average squared error of a learned map into two parts:

  • bias²: how far the fit is from the truth, on average over datasets;
  • variance: how much the fit changes from one dataset to the next.

At each input \( x \), with the average \( \mathbb{E} \) taken over datasets, the two parts add up exactly to the squared error: $$ \mathbb{E}\big[(\hat f(x) - f^*(x))^2\big] = \underbrace{\big(\mathbb{E}[\hat f(x)] - f^*(x)\big)^2}_{\text{bias}^2} + \underbrace{\mathbb{E}\big[(\hat f(x) - \mathbb{E}[\hat f(x)])^2\big]}_{\text{variance}}. $$ To see it, add and subtract \( \mathbb{E}[\hat f(x)] \) inside the square on the left and expand. The cross term averages to zero, because \( \hat f(x) - \mathbb{E}[\hat f(x)] \) does. Neither part can be seen in a single dataset. Fig. 3 measures both by redrawing the data many times.

Three panels of fitted curves against a dashed true quadratic. Lines all miss the curve in the same way. Cubics follow it with moderate scatter. Quartics follow it with the most scatter, especially near the edges.
Fig. 3. Three hypothesis classes, each fitted by least squares to 2,000 independent datasets. Every dataset is five noisy samples (noise standard deviation 0.25) of the same quadratic (dashed), at the inputs marked in red. Blue: 20 of the fits. Bias² and variance are averaged over the data range \( [-1, 1] \). Lines cannot bend, so every fit misses in the same way: large bias, small variance. Cubics and quartics contain the true quadratic, so their bias vanishes, but their fits scatter more as the class grows, most of all near the edges.

Adding the two parts, the cubics have the lowest total error (0.042, against 0.253 for lines and 0.067 for quartics), so bigger helps only up to a point. The quartics lose because, with five parameters and five points, every fit passes exactly through the noise. Which class wins depends on how much data and noise there is. Vary both in Fig. 3, or in the interactive playground, and watch the best degree move.

Where geometric deep learning comes in

The usual way to manage this trade-off is to adjust the size of \( \mathcal{F} \). The closing remark of §1.1 points to a different strategy, and it is the central idea of the whole field: restrict \( \mathcal{F} \) using knowledge of the problem's symmetries. If an image's label should not change when the image is shifted, there is no reason to search over maps whose output does change. Keeping only the maps that respect the symmetry gives a smaller class, which makes the search easier when data is scarce.

This does throw members out, including non-symmetric maps that may fit the training data well. But suppose the symmetry really holds in the data. Then, under mild conditions on the class and the loss, the best risk (expected error on new data) achievable in the smaller class is no worse than in the original one (Elesedy & Zaidi 2021).

Saying precisely what it means for a label not to change under a shift requires groups, group actions, invariance and equivariance. Those are the subject of Part 2.

Quick summary

The ideas of this post, each with its running example.

IdeaIn one lineExample in this postIn ML
Setmembership, nothing elsethe four stations \( \mathcal{S} \)a label set, a batch
Mapone output for every inputlabelling stations warm or colda trained network
Injective / surjectiveno merging / nothing missed16 labellings, none injective into 2 labelsclassifiers merge inputs
Compositionapply one map, then the nexta two-layer networkdepth
Cartesian productordered pairs4 stations × 2 labels = 8 pairsa dataset of \( (x, y) \)
Hypothesis classthe maps an architecture can reachlines, cubics, quartics (Fig. 3)choosing an architecture
Non-injective \( \theta \mapsto f_\theta \)many weights, one function\( 1000! \) unit orders, rescaled unitsmodel merging
Size trade-offbias² falls, variance risescubics win: 0.042 vs 0.253 and 0.067model selection

Open questions

Questions I'm carrying into the next parts:

  • Where does probability properly enter? Measuring variance in Fig. 3 meant redrawing datasets, so randomness is already in the picture. But this post never says what is being sampled. The standard answer treats \( \mathcal{D} \) as a sample from a probability distribution over \( \mathcal{X} \times \mathcal{Y} \). A map is then judged by its expected loss on fresh samples from the same distribution. §1.1 doesn't set this up; I want to see where the review does.
  • Is the architecture really the hypothesis class? Zhang et al. (2017) showed that standard image-classification networks can fit randomly assigned labels, so \( \mathcal{F} \) is enormous. Yet trained networks generalize. That suggests the optimizer and initialization search a much smaller effective class than the one the architecture declares.

Next, Part 2 makes symmetry precise with groups, actions, invariance and equivariance. Its payoff is a counting argument. A dense layer from a 224 × 224 image to another has about 2.5 billion weights. Ask only that shifting the input shifts the output, and the linear layers left are exactly the convolutions.

Code

All checks in this post, and Fig. 3, are in math-gdl-01-sets-maps.ipynb (NumPy and Matplotlib; runs in seconds). Each demo ends with a short exercise, such as adding an unused label to the codomain and predicting which assertion fails.

To skip the setup, open the interactive playground. It runs the same checks in your browser, with controls for the exercises: relabel the stations and change the codomain, rescale a hidden unit, or pick the polynomial degree, noise and sample size behind Fig. 3. The first load can take up to half a minute while Python starts up. Its source is math-gdl-01-sets-maps-playground.py, a marimo notebook.

Corrections are welcome at .

Next: Part 2, Groups, Symmetry, and Equivariance. Series overview: Eight Puzzles That Helped Me Understand Geometric Deep Learning.

Citation

Cited as:

Pham, Anh-Duy. (Nov 2026). Sets, maps, and the hypothesis class. Math for GDL, Part 1. https://www.adpham.de/blog/math-gdl-01-sets-maps.html

Or

@article{pham2026mathgdl01,
  title   = "Sets, Maps, and the Hypothesis Class",
  author  = "Pham, Anh-Duy",
  journal = "www.adpham.de",
  year    = "2026",
  month   = "Nov",
  url     = "https://www.adpham.de/blog/math-gdl-01-sets-maps.html"
}

References

  1. Sáez de Ocáriz Borde, H. & Bronstein, M. M. “Mathematical Foundations of Geometric Deep Learning.” arXiv:2508.02723 (2025).
  2. Bronstein, M. M., Bruna, J., Cohen, T. & Veličković, P. “Geometric Deep Learning: Grids, Groups, Graphs, Geodesics, and Gauges.” arXiv:2104.13478 (2021).
  3. Shalev-Shwartz, S. & Ben-David, S. Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press (2014).
  4. Cybenko, G. “Approximation by superpositions of a sigmoidal function.” Mathematics of Control, Signals, and Systems 2(4), 303–314 (1989).
  5. Hornik, K., Stinchcombe, M. & White, H. “Multilayer feedforward networks are universal approximators.” Neural Networks 2(5), 359–366 (1989).
  6. Leshno, M., Lin, V. Y., Pinkus, A. & Schocken, S. “Multilayer feedforward networks with a nonpolynomial activation function can approximate any function.” Neural Networks 6(6), 861–867 (1993).
  7. Geman, S., Bienenstock, E. & Doursat, R. “Neural networks and the bias/variance dilemma.” Neural Computation 4(1), 1–58 (1992).
  8. Zhang, C., Bengio, S., Hardt, M., Recht, B. & Vinyals, O. “Understanding deep learning requires rethinking generalization.” ICLR (2017).
  9. Elesedy, B. & Zaidi, S. “Provably strict generalisation benefit for equivariant models.” Proceedings of the 38th International Conference on Machine Learning, PMLR 139, 2959–2969 (2021).
  10. Zaheer, M., Kottur, S., Ravanbakhsh, S., Póczos, B., Salakhutdinov, R. & Smola, A. “Deep Sets.” Advances in Neural Information Processing Systems 30, 3391–3401 (2017).
  11. Qi, C. R., Su, H., Mo, K. & Guibas, L. J. “PointNet: Deep learning on point sets for 3D classification and segmentation.” CVPR (2017).
  12. Dinh, L., Sohl-Dickstein, J. & Bengio, S. “Density estimation using Real NVP.” ICLR (2017).
  13. Ainsworth, S. K., Hayase, J. & Srinivasa, S. “Git Re-Basin: Merging models modulo permutation symmetries.” ICLR (2023).
  14. Entezari, R., Sedghi, H., Saukh, O. & Neyshabur, B. “The role of permutation invariance in linear mode connectivity of neural networks.” ICLR (2022).