betaFeedback

WorksComputer Science

Data, Numbers, and Geometry: Three Tutorials on Numerical Methods, Machine Learning, and Evaluation

Abstract

We present three practical tutorials on numerical computation and machine learning for mathematical research, developed for the DANGER: Data, Numbers, and Geometry workshop held at the Banff International Research Station in April 2026. The first develops a numerical approach to exterior calculus from pointwise evaluations of differential forms, using a flux formulation of the exterior derivative. Examples in Euclidean space and on the sphere illustrate geometric identities, topological features, and the effects of approximation and finite precision. The second examines how mathematical structure guides neural network design through examples involving elliptic curves, quivers, and a boundary value problem. It explores how architectural choices affect learning and uses interval arithmetic to bound the residual of a trained network over the full interval of the boundary value problem. The third addresses the evaluation and presentation of machine learning results, covering performance metrics, statistical uncertainty, classification thresholds, receiver operating characteristic curves, and accessible figure design. Throughout, the tutorials distinguish numerical agreement, predictive accuracy, structural guarantees, and rigorous bounds as different forms of evidence. Each contribution can be read independently, with accompanying notebooks and exercises that allow readers to reproduce the examples and adapt the methods to other problems.

Introduction

These notes bring together three technique tutorials from DANGER: Data, Numbers, and Geometry, held at the Banff International Research Station in April 2026. They offer a practical introduction to computing with mathematical data and using machine learning in mathematical research. Our emphasis is on the choices behind a calculation: how the data are represented, which structure a method uses, and how its results are assessed.

Tomás S. R. Silva begins with exterior calculus when a differential form is available only through pointwise evaluations. Expressing the exterior derivative through boundary fluxes leads to a numerical method. Examples in Euclidean space and on the sphere show how geometric identities and topological features can be explored from data, with attention to approximation errors and finite precision.

Yidi Qi examines how the structure of mathematical data guides the choice of a neural network. The examples involve elliptic curves, quivers, and a boundary value problem. They show how architectural choices affect learning and which properties can be built into a model. The final example uses interval arithmetic to bound the residual of a trained network over the full interval of the boundary value problem.

Jessica N. Howard discusses how to evaluate and present machine learning results. The tutorial moves from choosing performance metrics and estimating uncertainty to designing clear, accessible figures. Classification serves as a detailed example, showing how decision thresholds and receiver operating characteristic curves help assess a model’s performance.

Throughout the collection, numerical agreement, predictive accuracy, and rigorous bounds are treated as different kinds of evidence. Each tutorial can be read independently, with its own notation and references. We encourage readers to work through the accompanying notebooks and exercises, vary the examples, and try the methods on questions of their own.

Tutorial 1: A data-driven view of exterior calculus

Tomás S. R. Silva

Classical computational tools for differential forms assume symbolic expressions, mesh discretizations, or smoothness close to C∞C^\infty. In data-driven settings one often has only oracle access: the ability to evaluate a form at arbitrary points and tangent vectors, with no closed-form expression and no mesh. Building on a flux-based reformulation of the exterior derivative, recently developed by the author with D. Fadel and H. N. Sá Earp, in which the exterior derivative is recovered as a limit of normalized boundary integrals over shrinking blocks, we describe a mesh-free, symbol-free numerical scheme for exterior differentiation, valid under regularity assumptions weaker than C1C^1. We demonstrate the method in R\mathbb{R}, R3\mathbb{R}^3 and on the sphere S2S^2, verifying Stokes’ theorem, the identity d2=0\mathrm{d}^2 = 0, and Gauss–Bonnet purely from pointwise samples, and detecting de Rham cohomology (closed-but-not-exact forms) from data. Companion Jupyter notebooks accompany the paper. This article is based on a tutorial delivered at DANGER: Data, Numbers, and Geometry (Banff, April 2026).

Keywords: Exterior derivative; Stokes’ theorem; numerical exterior derivative; black-box methods; differential forms; de Rham cohomology.

Mathematics Subject Classification 2020: 26B05, 58A10, 65D25

Motivation: The Black-Box Perspective

Differential forms are the common language for flux through surfaces, circulation along curves, densities, and conservation laws; they organize electromagnetism, fluid vorticity, curvature in general relativity, and, increasingly, data analysis on manifolds. The unifying operation is the exterior derivative d\mathrm{d}, which subsumes gradient, curl and divergence into a single operator satisfying d2=0\mathrm{d}^2 = 0 and encoding topology through the obstructions to solving dη=ω\mathrm{d}\eta= \omega.

Textbook methods for computing with forms, however, assume too much. They require a symbolic formula for the form (often unavailable), a mesh or triangulation of the domain (expensive in high dimension), or smoothness close to C∞C^\infty (too restrictive). Discrete Exterior Calculus computes d\mathrm{d} via cochains on a simplicial mesh [1], and Finite Element Exterior Calculus exploits the structure of a discrete de Rham complex [2]; both are powerful, and both presuppose a discretized domain. In practice – for instance when the form is produced by a trained neural network, a simulation, or a measurement process – we often have only pointwise samples: “We can evaluate ωp(v1,…,vk)\omega_p(v_1,\ldots,v_k) for any point pp and tangent vectors viv_i, but we have no closed-form expression and no mesh.”

This paper takes that constraint as the starting point. Given only oracle access to ω\omega:

  1. Can we compute dω\mathrm{d}\omega numerically?

  1. Can we verify Stokes’ theorem from data?

  1. Can we detect topology (e.g., closed but not exact) from data?

The answer to all three is yes, and the key insight is a geometric reading of the derivative, made rigorous in Ref. 3. Sections 2 and 3 summarize the theory and the resulting algorithm; Secs. 4 and 5 report numerical experiments in flat space and on the sphere, answering questions 1–3 in turn.

The Exterior Derivative as Infinitesimal Flux

Start in dimension one. If f:R→Rf:\mathbb{R}\to\mathbb{R} is differentiable at aa, then

f′(a)=lim⁡r→0f(a+r)−f(a−r)2r=lim⁡r→01vol⁡(Br(a))∫∂Br(a)f,(1)f'(a)=\lim_{r\to0}\frac{f(a+r)-f(a-r)}{2r}=\lim_{r\to0}\frac{1}{\operatorname{vol}(B_r(a))}\int_{\partial B_r(a)}f, \tag*{(1)}

where the interval Br(a)=[a−r,a+r]B_r(a)=[a-r,a+r] is regarded as an oriented one-chain, so that ∫∂Br(a)f=f(a+r)−f(a−r)\int_{\partial B_r(a)}f=f(a+r)-f(a-r). Read geometrically: the derivative is the infinitesimal flux of ff through the boundary of a shrinking ball, normalized by volume. This viewpoint, first proposed by Acker [4, 5, 6] and developed systematically in Ref. 3, generalizes verbatim to (k−1)(k-1)-forms in Rn\mathbb{R}^n.

Definition 2.1 (Flux-based exterior derivative, Ref. 3, Def. 11). Let ω\omega be a (k−1)(k-1)-form on an open set U⊂RnU\subset\mathbb{R}^n, flux-integrable around x∈Ux\in U. We say ω\omega is derivable at xx, with exterior derivative Dωx∈Λk(Rn)∗D\omega_x\in\Lambda^k(\mathbb{R}^n)^*, if for every open set A⊂RkA\subset\mathbb{R}^k, every point p∈Ap\in A, every choice of vectors v1,…,vk∈Rnv_1,\ldots,v_k\in\mathbb{R}^n, and every C1C^1 map φ:A→U\varphi:A\to U with φ(p)=x\varphi(p)=x and φ′(p)ei=vi\varphi'(p)e_i=v_i for i=1,…,ki=1,\ldots,k,

Dωx(v1,…,vk)=lim⁡B→p1vol⁡(B)∫∂Bφ∗ω,(2)D\omega_x(v_1,\ldots,v_k)=\lim_{B\to p}\frac{1}{\operatorname{vol}(B)}\int_{\partial B}\varphi^*\omega, \tag*{(2)}

where, for every fixed K>1K>1, the limit is taken over kk-blocks B⊂AB\subset A containing pp and shrinking to pp, with L(B)/l(B)<KL(B)/l(B)<K.

The aspect-ratio condition controls diam⁡(B)⋅area⁡(∂B)/vol⁡(B)\operatorname{diam}(B)\cdot\operatorname{area}(\partial B)/\operatorname{vol}(B) and is what makes the definition well posed; see Sec. 3 of Ref. 3. Crucially, derivability is strictly weaker than classical differentiability – ω\omega need not even be continuous at xx for DωxD\omega_x to exist. The main structural results are the following.

Theorem 2.1 (Ref. 3, Secs. 2–4). Let U⊂RnU\subset\mathbb{R}^n be open.

(i) (Mean value equality) If ω\omega is a flux-continuous (k−1)(k-1)-form on a kk-block BB, derivable on B˚\mathring{B}, then there exists ξ∈B˚\xi\in\mathring{B} with Dωξ(e1,…,ek)=1vol⁡(B)∫∂BωD\omega_\xi(e_1,\ldots,e_k)=\frac{1}{\operatorname{vol}(B)}\int_{\partial B}\omega.

(ii) (Stokes without C1C^1) If ω∈Ωk(U)\omega\in\Omega^k(U) is continuous on c(B)c(B) and differentiable on c(B˚)c(\mathring{B}) for a C1C^1 singular (k+1)(k+1)-block c:B→Uc:B\to U, then ∫∂cω=∫cdω\int_{\partial c}\omega=\int_c d\omega whenever the right-hand side exists.

(iii) (D2=0D^2=0) Under natural integrability hypotheses, D(Dω)=0D(D\omega)=0.

(iv) (Compatibility) If ω\omega is differentiable at x0x_0, then ω\omega is derivable at x0x_0 and Dωx0=dωx0D\omega_{x_0}=d\omega_{x_0}.

Item (i) is a genuine higher-dimensional Mean Value Theorem in equality form, obtained by iterating a Trisection Lemma on nested sub-blocks; item (ii) then follows by the same subdivision argument that derives the Fundamental Theorem of Calculus from the classical MVT, with the usual C1C^1 hypothesis on the integrand relaxed to exactly the FTC-type assumptions. For the present purposes the punchline is item (iv): Eq. (2.2) computes the classical dωd\omega whenever the latter exists. The flux formula is therefore a licensed numerical definition of the exterior derivative – and it consumes only pointwise evaluations of ω\omega.

The Black-Box Algorithm and its Error Budget

Fix a point x∈Rnx\in\mathbb{R}^n, a degree kk, and a step size ε>0\varepsilon>0. Discretizing Eq. (2.2) on the axis-aligned cube of side 2ε2\varepsilon spanned by eq1,…,eqke_{q_1},\ldots,e_{q_k}, and approximating each face integral by its midpoint value, yields the centered stencil [3]

Dωx(eq1,…,eqk)≈12ε∑i=1k∑j=01(−1)i+jωx+(−1)j+1εeqi(eq1,…,eqi^,…,eqk),(3)D\omega_x(e_{q_1},\ldots,e_{q_k}) \approx\frac{1}{2\varepsilon}\sum_{i=1}^{k}\sum_{j=0}^{1}(-1)^{i+j}\omega_{x+(-1)^{j+1}\varepsilon e_{q_i}}(e_{q_1},\ldots,\widehat{e_{q_i}},\ldots,e_{q_k}), \tag*{(3)}

for each increasing multi-index Q={q1<⋯<qk}Q=\{q_1<\cdots<q_k\}. The scheme is summarized in Algorithm 1; a reference implementation is available at

https://github.com/TomasSilva/NumericalExteriorDerivative

Algorithm 1 Numerical exterior derivative in Rn\mathbb{R}^n (black-box)

Require: oracle sampler for a (k−1)(k-1)-form ω\omega; point x∈Rnx\in\mathbb{R}^n; step ε>0\varepsilon>0

Ensure: numerical components of DωxD\omega_x

  1. initialize the component array of Dωx∈Λk(Rn)∗D\omega_x\in\Lambda^k(\mathbb{R}^n)^* to zero

  2. for all multi-indices q1<⋯<qkq_1<\cdots<q_k do

  3. set Dωx(eq1,…,eqk)D\omega_x(e_{q_1},\ldots,e_{q_k}) equal to the right-hand side of Eq. (3.1), using 2k2k oracle queries

  4. end for

  5. extend the increasing-index components to all indices by antisymmetry

  6. return DωxD\omega_x

Properties

No mesh is required – only pointwise evaluations. No symbolic expression is needed – the form is a pure black box. The underlying flux definition remains meaningful under regularity assumptions weaker than C1C^1 (Theorem 2.1). For oracle forms with locally C3C^3 coefficient functions, the centered stencil has truncation error O(ε2)O(\varepsilon^2).

The Fundamental Tension

In floating-point arithmetic the truncation error O(ε2)O(\varepsilon^2) competes against catastrophic cancellation O(εmach/ε)O(\varepsilon_{\mathrm{mach}}/\varepsilon) in the difference quotient. The total error is V-shaped in ε\varepsilon (Fig. 1), with sweet spot ε∗∼εmach1/3≈10−5\varepsilon^*\sim\varepsilon_{\mathrm{mach}}^{1/3}\approx10^{-5} in double precision. When the oracle is noisy with amplitude σ\sigma – the relevant regime when ω\omega is produced by a trained network or by measurements – the optimum shifts to ε∗∼σ1/3\varepsilon^*\sim\sigma^{1/3}: noisier oracles demand larger probe regions.

Experiments in Flat Space

In R3\mathbb{R}^3 the single formula (3.1) specializes to the three classical operators of vector calculus: the probe region grows with the degree, and only the dimension of the boundary changes (Table 1). All that is needed is black-box evaluation of the form: a zero-form is an oracle f(point)→float\mathbf{f}(\mathrm{point})\to\mathrm{float}, a one-form returns the component vector [ω(e1),ω(e2),ω(e3)][\omega(e_1),\omega(e_2),\omega(e_3)], a two-form returns the skew-symmetric matrix [η(ei,ej)][\eta(e_i,e_j)].

Exact and Non-closed Forms

For ω=x dx+y dy+z dz=d(12(x2+y2+z2))\omega=x\,\mathrm{d}x+y\,\mathrm{d}y+z\,\mathrm{d}z=\mathrm{d}\left(\frac{1}{2}(x^2+y^2+z^2)\right) the algorithm returns dω=0\mathrm{d}\omega=0 to machine precision. For the non-closed form ω=z dx+x dy+y dz\omega=z\,\mathrm{d}x+x\,\mathrm{d}y+y\,\mathrm{d}z it recovers curl⁡(ω)=(1,1,1)\operatorname{curl}(\omega)=(1,1,1) with error ∼10−11\sim10^{-11}.

Truncation versus cancellation for the centered stencil

Figure 1. Truncation vs. cancellation for the centered stencil of Eq. (3.1). The optimum ε∗≈10−5\varepsilon^{*} \approx10^{-5} balances the two regimes; under oracle noise of amplitude σ\sigma it shifts to ε∗∼σ1/3\varepsilon^{*} \sim\sigma^{1/3}.

0-form ff1-form ω\omega2-form η\eta
output of d1-form dfdf2-form dωd\omega3-form dηd\eta
classical namegradientcurldivergence
probe regionsegment [a,b][a,b]parallelogramparallelepiped
boundary ∂\partial2 oriented points4 oriented edges6 oriented faces
boundary integralf(b)−f(a)f(b)-f(a)∑edges∫ω\sum_{\mathrm{edges}}\int\omega∑faces∬η\sum_{\mathrm{faces}}\iint\eta
d2=0d^2=0 says. . .curl⁡(grad⁡f)=0\operatorname{curl}(\operatorname{grad} f)=0div⁡(curl⁡ω)=0\operatorname{div}(\operatorname{curl}\omega)=0(top degree)(\text{top degree})

Table 1. The unified picture in R3\mathbb{R}^{3}: one algorithm, three classical operators.

d2=0d^2=0 from Data

Starting from f(x,y,z)=e−(x2+y2+z2)f(x,y,z)=e^{-(x^2+y^2+z^2)}, we compute dfdf numerically (a one-form), then d(df)d(df) numerically (a two-form), chaining two applications of Algorithm 1. The result is ∣d2f∣∼10−17|d^2f|\sim10^{-17}: the identity curl⁡(grad⁡f)=0\operatorname{curl}(\operatorname{grad} f)=0 is confirmed from data alone.

Topology from Data: The Vortex Form

Consider

ω=−y dx+x dyx2+y2on R3∖{z-axis}.(4)\omega=\frac{-y\,dx+x\,dy}{x^2+y^2}\quad\text{on }\mathbb{R}^{3}\setminus\{z\text{-axis}\}. \tag*{(4)}

The algorithm sees: dω=0d\omega=0 at every test point away from the axis (the form is closed), and ∣dω∣→∞|d\omega|\to\infty when the stencil straddles the singular axis. What the algorithm cannot see pointwise: there is no function ff with df=ωdf=\omega; the form is not exact, and ∮γω=2π wind⁡(γ,z-axis)\oint_{\gamma}\omega=2\pi\,\operatorname{wind}(\gamma,z\text{-axis}); in particular, it equals 2π2\pi for a positively oriented loop of winding number one. The method recovers this value by numerical line integration of oracle samples. The lesson: dω=0d\omega=0 is local (checkable pointwise by Algorithm 1), while non-exactness is global – it requires integrating around loops. The gap between the two is de Rham cohomology, and it is detectable from data.

Stokes’ Theorem from Data

Take ω=z dx+x dy+y dz\omega= z\,dx + x\,dy + y\,dz, Σ\Sigma the unit disk in the plane z=1z = 1, ∂Σ\partial\Sigma the unit circle. Computing ∫Σdω\int_{\Sigma} d\omega by applying Algorithm 1 at quadrature points and ∮∂Σω\oint_{\partial\Sigma} \omega by direct oracle evaluation along the boundary gives

∫Σdω=3.14159265…,∮∂Σω=3.14159265…,∣diff∣∼10−8,(5)\int_{\Sigma} d\omega= 3.14159265\ldots,\qquad\oint_{\partial\Sigma} \omega= 3.14159265\ldots,\qquad\lvert\mathrm{diff}\rvert\sim10^{-8}, \tag*{(5)}

with both sides computed from black-box evaluations only – no formula for curl⁡(ω)\operatorname{curl}(\omega) was used.

Experiments in Curved Manifolds: The Sphere

On S2⊂R3S^2 \subset\mathbb{R}^3 three things change: the tangent space TpS2={v:v⋅p=0}T_pS^2 = \{v : v \cdot p = 0\} varies with pp; stencil points p±εtp \pm\varepsilon t leave the sphere; and a two-form is top degree (dim⁡S2=2\dim S^2 = 2), hence a scalar density. The fix is minimal: replace the canonical basis eie_i by an orthonormal tangent frame (t1,t2)(t_1,t_2) at pp, and project stencil points radially back to the sphere, π(q)=q/∣q∣\pi(q) = q/\lvert q\rvert. Set p±i=π(p±εti)p_{\pm i} = \pi(p \pm\varepsilon t_i) and sε=(1+ε2)−1/2s_\varepsilon= (1+\varepsilon^2)^{-1/2}. For zero- and one-forms, respectively,

(df)p(ti)≈f(p+i)−f(p−i)2ε,(dω)p(t1,t2)≈sε2ε[ωp+1(t2)−ωp−1(t2)−ωp+2(t1)+ωp−2(t1)].(6)\begin{aligned} (df)_p(t_i) &\approx\frac{f(p_{+i}) - f(p_{-i})}{2\varepsilon},\\ (d\omega)_p(t_1,t_2) &\approx\frac{s_\varepsilon}{2\varepsilon}\left[\omega_{p_{+1}}(t_2)-\omega_{p_{-1}}(t_2)-\omega_{p_{+2}}(t_1)+\omega_{p_{-2}}(t_1)\right]. \tag*{(6)} \end{aligned}

The factor sεs_\varepsilon is the tangent-vector scaling induced by the differential of the radial projection. The structural insight making this work is naturality. For the local parametrization Φ(u1,u2)=π(p+u1t1+u2t2)\Phi(u_1,u_2) = \pi(p + u_1t_1 + u_2t_2), classical naturality gives d(Φ∗ω)=Φ∗(dω)d(\Phi^*\omega) = \Phi^*(d\omega), so the flat-space stencil applied to Φ∗ω\Phi^*\omega computes the intrinsic exterior derivative at pp. The corresponding naturality statement for DD on open Euclidean sets is Ref. 3, Lemma 13. For sufficiently smooth oracle data, this chart-based stencil retains O(ε2)O(\varepsilon^2) convergence and the same εmach1/3\varepsilon_{\mathrm{mach}}^{1/3} scaling of the optimal step size.

Gradient of the Height Function

For f(p)=zf(p) = z the intrinsic gradient ∇S2f\nabla_{S^2} f should point toward the north pole, have magnitude sin⁡θ\sin\theta, and vanish at the poles. The algorithm recovers ∣∇S2f∣=sin⁡θ\lvert\nabla_{S^2}f\rvert= \sin\theta to the displayed six decimal places at the equator (1.000000), at 45°N (0.707107), near the pole (0.010000) and at the pole itself (0.000000), locating the critical points exactly.

dωd\omega Matches the Analytical Result

For the rotation form ω=x dy−y dx\omega= x\,dy-y\,dx pulled back to S2S^2, the analytical answer is dω∣S2=2z⋅ωaread\omega\vert_{S^2} = 2z\cdot\omega_{\mathrm{area}}. Over 200 random points the maximal error is ∼10−10\sim10^{-10}; the computed density is positive in the northern hemisphere, negative in the southern, and vanishes at the equator. The algorithm sees the geometry of the sphere – curvature, latitude – through black-box evaluations alone.

Stokes on Geodesic Caps

For the cap Σ={z≥z0}\Sigma= \{z \ge z_0\} with boundary circle ∂Σ\partial\Sigma at height z0z_0, both sides of ∫Σdω=∮∂Σω\int_{\Sigma} d\omega= \oint_{\partial\Sigma} \omega equal 2π(1−z02)2\pi(1-z_0^2) exactly. The numerical verification is reported in Table 2: neither side used a formula for dωd\omega.

Gauss–Bonnet

Integrating the area form ωarea(t1,t2)=p⋅(t1×t2)\omega_{\mathrm{area}}(t_1,t_2)=p\cdot(t_1\times t_2) over the whole sphere by oracle sampling recovers ∫S2ωarea=4π\int_{S^2}\omega_{\mathrm{area}}=4\pi. Since the unit sphere has K≡1K\equiv1, this area integral also equals the Gauss–Bonnet total-curvature integral ∫S2K dA=2πχ(S2)=4π\int_{S^2}K\,dA=2\pi\chi(S^2)=4\pi, with χ(S2)=2\chi(S^2)=2. It is the total curvature ∫K dA\int K\,dA, rather than the area itself, that is topologically invariant.

d2=0 on a Curved Manifold

Chaining two numerical derivatives on the sphere – f(p)=zf(p)=z, then dfdf, then d(df)d(df) – yields ∣d2f∣∼10−6\lvert d^2f\rvert\sim10^{-6} at every test point. The error is larger than in R3\mathbb{R}^3 because two numerical derivatives are chained, each using projected stencil points. In exact arithmetic it converges to zero as ε→0\varepsilon\to0; in finite precision, convergence persists only down to the optimal step size, after which cancellation dominates. The identity d2=0d^2=0 is universal, and verifiable from black-box evaluations alone.

Summary

Pointwise evaluation of differential forms is sufficient to recover their exterior derivatives, verify Stokes’ theorem, and detect topological features – on flat spaces and curved manifolds alike.

Outlook: Learning Geometry from Data

The natural habitat of the black-box scheme is the growing interface between machine learning and differential geometry, where forms are increasingly learned rather than written down. In Ref. 7, neural networks learn a Ricci-flat metric on a Calabi–Yau threefold and approximate the G2G_2-structure three-form on the associated seven-dimensional link in S9S^9; the numerical exterior derivative described here serves as the validation layer, certifying (co)closure conditions of the learned forms without symbolic access to them. In that regime the noisy-oracle analysis of Sec. 3.2 (ε∗∼σ1/3\varepsilon^*\sim\sigma^{1/3}) is the operative one.

Natural next steps include systematic exterior calculus on learned implicit manifolds, estimation of de Rham cohomology from sampled forms via the local-to-global gap exhibited by the vortex example, and higher-degree stencils in the ambient dimensions relevant to special holonomy. The three tutorial notebooks (block1_1d_story.ipynb, block2_R3_forms.ipynb, block3_S2_forms.ipynb), covering every experiment reported above with guided exercises, are available at https://github.com/TomasSilva/Banff-Tutorial, alongside the SageMath [8] reference implementation.

Acknowledgments

The author thanks Daniel Fadel and Henrique N. Sá Earp, co-authors of the survey [3] underlying this tutorial, and the DANGER organizers – Edward Hirst, Elli Heyes, Miranda Cheng and Sergei Gukov – for the invitation and for assembling such a stimulating meeting. The ideas revisited here originate with Felipe Acker [4, 5, 6]. The author was supported by the São Paulo Research Foundation (FAPESP), grant 2022/09891-4.

ORCID

Tomás S. R. Silva – https://orcid.org/0000-0002-5825-9133

Tutorial 2: Architectures for mathematical data

Yidi Qi

Mathematical objects rarely arrive as unstructured feature vectors. They arrive as sequences indexed by primes, as directed graphs closed under a combinatorial move, as functions constrained by a differential equation. Choosing a neural architecture is therefore not a matter of choosing the largest model, but of choosing an inductive bias that matches the structure the data already has. We develop this principle through three self-contained case studies, each implemented from scratch in JAX and each runnable on a laptop CPU. (i) Sequential data: a 1D CNN and a single-block transformer predict the rank of an elliptic curve E/QE/\mathbb{Q} from its normalized Frobenius traces a~p\tilde{a}_p; a saliency analysis tracked across training shows the network localizing the discriminative signal in the small primes, where the murmuration phenomenon lives. (ii) Graph data: a directed graph isomorphism network classifies quivers by Dynkin mutation type, is permutation equivariant to machine zero by construction, and—trained only on 7 and 8 vertices—transfers to quivers on 9 vertices. (iii) Continuous data: a physics-informed neural network solves a two-point boundary value problem, after which interval arithmetic bounds the residual rigorously over the entire domain rather than at the collocation points. Companion Jupyter notebooks can be viewed at https://github.com/yidiq7/Banff-Tutorial-Architecture. Based on a tutorial delivered at DANGER: Data, Numbers, and Geometry (Banff, April 2026).

Tutorial 2: Architectures for mathematical data

Introduction: Inductive biases of the architectures

Machine learning enters mathematics along two broadly distinct routes. In the first, the model is a reasoning engine: language models and agents that prove theorems, generate conjectures, or search proof spaces. In the second, mathematical objects are treated as structured data—invariants, sequences, graphs, functions—and the task is to learn a map from that data to a quantity of interest, sometimes as a route to human insight. [1, 2] This tutorial is about the second route, and about one question inside it: given the data, which architecture?

The question has content because architectures are not interchangeable function approximators. Each carries an inductive bias: structural assumptions baked into the hypothesis class before training. A convolution assumes the same local pattern is meaningful wherever it occurs; a message-passing layer assumes the answer does not depend on how the vertices are numbered; a physics-informed loss assumes the target satisfies a differential equation. When the assumption matches the mathematics it buys sample efficiency, generalization and—as in Sec. 3—exact structural guarantees no amount of training data can supply. Table 1 is the map used to organize the tutorial.

We develop three of the rows further below against genuine mathematical problems and datasets: sequential (Sec. 2), predicting the rank of an elliptic curve over Q\mathbb{Q} from its Frobenius traces; graph (Sec. 3), classifying quivers by Dynkin mutation type; and continuous (Sec. 4), solving a boundary value problem with a PINN and then verifying the result rigorously.

Data typeKey structureArchitecture(s)Inductive bias
Tabularunstructured featuresMLP, boosted treessmoothness; axis-aligned splits
Sequentialorder, locality1D CNN, transformer, SSMshift equivariance; attention; recurrence
Grid / image2D spatial structure2D CNN, ViT, U-Net2D translation equivariance, locality
Set / multisetno orderingDeepSets, set transformerpermutation-invariant aggregation
Graphnodes, edges, topologyGNN (message passing)permutation equivariance, locality
Geometricsymmetry group (E(3),…E(3),\ldots)equivariant networksgroup equivariance by construction
Continuous / PDEsmoothness, differential equationsPINN, FNO, Deep-ONetPDE constraints; operator learning

Table 1 (PDF p. 10). The landscape: from the structure of the data to the architecture that encodes it.

Sequential Data: Elliptic Curve Rank from Frobenius Traces

The data and the task

For an elliptic curve E/QE/\mathbb{Q} of conductor NN and a prime p∤Np \nmid N, the Frobenius trace is ap(E)=p+1−#E(Fp)a_p(E) = p + 1 - \#E(\mathbb{F}_p), and the Hasse bound ∣ap∣≤2p\lvert a_p\rvert\le2\sqrt{p} makes

a~p(E)=ap(E)2p∈[−1,1](7)\widetilde{a}_p(E) = \frac{a_p(E)}{2\sqrt{p}} \in[-1,1] \tag*{(7)}

a natural normalization. [3] Collectively the apa_p determine L(E,s)=∑nann−sL(E,s) = \sum_n a_n n^{-s}, whose order of vanishing at s=1s=1 is the analytic rank; Birch–Swinnerton-Dyer predicts this equals the rank of E(Q)E(\mathbb{Q}). Our dataset consists of 17,340 curves of conductor N≤3000N \le3000 (9,323 of rank 0, 8,017 of rank 1), each represented by the vector (a~2,a~3,…,a~9973)(\widetilde{a}_2,\widetilde{a}_3,\ldots,\widetilde{a}_{9973}) of 1,229 normalized traces at all primes p<104p < 10^4. The task is binary classification of the analytic rank, 0 versus 1, on an 80/20 split (13,872 train, 3,468 test), with per-position standardization fitted on the training set only.

What makes this sequential rather than tabular is the murmuration phenomenon: averaging apa_p over all curves of a fixed rank in a fixed conductor range and plotting against pp produces an oscillation whose phase and sign depend on the rank. [4, 5] In the conductor range used here it shows up as a large excursion of the two class averages, opposite in sign and concentrated at small pp (Fig. 1(a),(b)), which is invisible in any single curve (Fig. 1(c)). The discriminative structure is therefore a pattern along the prime axis—exactly what a locality-respecting architecture is built to detect.

Two architectures, one parameter budget

A 1D convolution slides a kernel of width kk along the sequence,

(W∗x)t=∑j=0k−1Wjxt+j,(8)(W \ast x)_t = \sum_{j=0}^{k-1} W_j x_{t+j}, \tag*{(8)}

Figure 1 (PDF p. 11). (a) Class-averaged Frobenius traces apa_p over the training split. (b) The same after Hasse normalization, a~p=ap/(2p)\tilde{a}_p = a_p/(2\sqrt{p}). In both, the two class averages are near mirror images and their separation is largest at small pp. (c) Two individual curves over the first 100 primes: the per-curve signal is indistinguishable from noise, so the pattern is a property of the sequence, recoverable only in aggregate.

so a pattern detected at one position produces the same response elsewhere. [6] This is translation equivariance along the prime index; with pooling, a few kernels can look for local oscillations at every scale. Our CNN is Conv⁡(1→8,k=5)→ReLU⁡→MaxPool⁡(4)→Conv⁡(8→16,k=5)→ReLU⁡→MaxPool⁡(4)\operatorname{Conv}(1 \to8, k=5) \to\operatorname{ReLU} \to\operatorname{MaxPool}(4) \to\operatorname{Conv}(8 \to16, k=5) \to\operatorname{ReLU} \to\operatorname{MaxPool}(4), flattened to 76×1676 \times16 and classified by a two-layer head.

The control is an MLP of shape 1,229→32→16→21{,}229 \to32 \to16 \to2, which sees the input as a flat vector in R1229\mathbb{R}^{1229}: every prime position gets dedicated weights and the ordering of the primes is, to the model, arbitrary. The two models are sized to essentially the same parameter count (39,714 versus 39,922), so the comparison is about inductive bias rather than capacity, and both are trained identically: Adam, learning rate 10−310^{-3}, batch size 512, ten epochs.

Table 2: Rank classification on 3,468 held-out curves. The CNN and MLP have matched parameter budgets and see all 1,229 primes; the transformer sees only the first 100 (p≤541p \le541), where attention’s O(T2)O(T^2) cost is affordable, so its accuracy is not directly comparable to the other two.

ModelInputParametersTrain acc.Test acc.
1D CNN1,229 primes39,71499.91%99.88%
MLP1,229 primes39,922100.00%99.13%
Transformer100 primes11,74699.53%99.51%

Table 2 (PDF p. 11). Rank classification on 3,468 held-out curves.

Table 2 reports the outcome. Both models solve the task, which is worth stating: the rank is recoverable from apa_p data to nearly 100% accuracy, consistent with earlier data-scientific studies of BSD. [4, 7] The instructive difference is the generalization gap. The MLP memorizes the training set exactly (100.00%) and returns 99.13% on held-out curves, a gap of 0.87 points; the CNN, at the same parameter count, closes it to 0.03 points (99.91% versus 99.88%). Weight sharing along the prime axis removes degrees of freedom the data does not need—and what it removes is what the MLP spends on memorization.

z0z_0surface integralline integral∣diff∣\lvert\mathrm{diff}\rvert
0.06.28318536.2831853∼10−8\sim10^{-8}
0.54.71238904.7123890∼10−8\sim10^{-8}
0.91.19380521.1938052∼10−8\sim10^{-8}

Table 2. Stokes’ theorem on geodesic caps Σ={z≥z0}⊂S2\Sigma= \{z \ge z_0\} \subset S^2, verified from black-box evaluations only. Exact value: 2π(1−z02)2\pi(1-z_0^2).

One caveat keeps this honest: the task is nearly saturated, so the comparison discriminates between 99.1% and 99.9% rather than between success and failure. A harder version—higher ranks, larger conductors, fewer primes—would separate the two architectures more sharply, and the gap reported here should be read as an indication of direction rather than of magnitude.

What the network learned: saliency across training

A classifier that is right for the wrong reason is not evidence about mathematics. Following the standard construction, [8] define the per-class saliency at prime pp as the average sensitivity of the logit SvS_v for class vv to the input coordinate a~p\tilde{a}_p,

Wp(v)=1∣{E:v^(E)=v}∣∑v^(E)=v∂Sv(E)∂a~p,(9)W_p^{(v)}=\frac{1}{\lvert\{E:\hat{v}(E)=v\}\rvert}\sum_{\hat{v}(E)=v}\frac{\partial S_v(E)}{\partial\tilde{a}_p}, \tag*{(9)}

the average running over the held-out curves the network assigns to class vv; in JAX this is one call to jax.grad composed with jax.vmap. Figure 2 plots the rescaled map W~p(v)=Wp(v)/max⁡q∣Wq(v)∣\widetilde{W}_p^{(v)}=W_p^{(v)}/\max_q\lvert W_q^{(v)}\rvert, so only the shape matters. Evaluating Eq. (2.3) at every epoch checkpoint turns interpretability into a movie rather than a snapshot.

Figure 2. Rescaled per-class saliency of the 1D CNN at three training checkpoints. At epoch 1 the map is unstructured noise. By epoch 4 it has become smooth and antisymmetric between the two classes, with oscillatory structure below p≈4000p \approx4000. By epoch 7 the sensitivity is sharply concentrated in the small primes and decays towards zero for large pp: the network has localized the discriminative signal in exactly the regime where the class averages of Fig. 1 separate.

Three features are worth naming. The saliency is antisymmetric between classes, W(0)≈−W(1)W^{(0)}\approx-W^{(1)}, the correct signature for a binary discriminant built on a signed statistic. It becomes smooth in pp, the fingerprint of weight sharing and not something an MLP produces. And it concentrates: mass migrates over training towards p≲2000p\lesssim2000, the regime where the class averages of Fig. 1(b) separate most cleanly. The direction of inference matters: this shows the CNN weighting the region where the known murmuration signal is strongest, not the CNN independently discovering murmurations.

Attention as a different bias

Self-attention makes no locality assumption: every position may attend to every other, and ordering enters only through an explicit positional encoding. [9] The price is the O(T2)O(T^2) cost of the attention matrix, so we restrict to the first T=100T=100 primes (p≤541p\le541) and build one encoder block from scratch—input projection, sinusoidal positional encoding, two-head scaled dot-product attention with residual connection and layer normalization, position-wise feedforward, mean pooling, linear classifier. With 11,746 parameters it reaches 99.51% (Table 2).

This is not a like-for-like comparison with the CNN, which sees all 1,229 primes, and we do not read it as one: the point is that a bias making no locality assumption at all still recovers the rank from a twelfth of the input. Attention is the more flexible bias and it is not free—quadratic cost is what forced the truncation in the first place. It earns that cost when the relevant interactions are long range, and deciding whether they are is a question about the mathematics, not the model.

Graph Data: Quivers and Mutation Classes

Quivers, mutation, and the task

A quiver is a directed multigraph, encoded here by a skew-symmetric exchange matrix BB with bij>0b_{ij} > 0 recording bijb_{ij} arrows i→ji \to j. The mutation μk\mu_k at a vertex kk acts by [10]

bij′={−bij,i=k or j=k,bij+∣bik∣bkj+bik∣bkj∣2,otherwise,(10)b'_{ij} = \begin{cases} -b_{ij}, & i = k \text{ or } j = k,\\ b_{ij} + \dfrac{\lvert b_{ik}\rvert b_{kj} + b_{ik}\lvert b_{kj}\rvert}{2}, & \text{otherwise,} \end{cases} \tag*{(10)}

which combinatorially means: complete every 2-path i→k→ji \to k \to j by a new arrow i→ji \to j, reverse all arrows at kk, then cancel any 2-cycles created. Mutation generates an equivalence relation, and the mutation class of a Dynkin quiver is a basic invariant in the theory of cluster algebras.

We take the families AnA_n (the path 0→1→⋯→n−10 \to1 \to\cdots\to n-1) and DnD_n (a path with a fork at n−3n-3), apply between 5 and 25 random mutations to each seed, deduplicate the resulting exchange matrices, and ask the model to recover the type. After a handful of mutations the quivers carry cycles, multiple arrows and reversed orientations and no longer resemble their Dynkin diagrams, so this is not pattern matching. The construction follows the setting of Ref. 11, which studies mutation-class classification with GNNs at larger scale and with explainability methods. We train on 800 quivers with n=7,8n = 7, 8 vertices and test on 100 quivers with n=9n = 9—a size never seen during training.

DirGINE: three design decisions

A message-passing layer updates each vertex from its neighbours, hv′=σ(∑u∈N(v)f(hu))\mathbf{h}'_v = \sigma\left(\sum_{u \in N(v)} f(\mathbf{h}_u)\right), which in matrix form is a single product A⋅f(H)A \cdot f(H). [12] Three choices turn this skeleton into an architecture suited to quivers.

Sum, not mean. Mean aggregation is not injective on multisets: distinct neighbourhoods collapse to the same output. The Graph Isomorphism Network replaces it by a raw sum followed by an MLP,

hv′=MLP⁡(hv+∑u∈N(v)hu),(11)\mathbf{h}'_v = \operatorname{MLP}\left(\mathbf{h}_v + \sum_{u \in N(v)} \mathbf{h}_u\right), \tag*{(11)}

which is provably as expressive as the 1-Weisfeiler–Leman test. [13]

Direction matters. Mutation reverses arrows, so two quivers with the same underlying undirected graph but different orientations may lie in different mutation classes; an orientation-blind model discards exactly the information the task turns on. Following Ref. 14, we split aggregation into an incoming and an outgoing channel,

hv(ℓ+1)=ReLU⁡(Whv(ℓ)+b+∑u→vφin(hu(ℓ))+∑v→wφout(hw(ℓ))),(12)\mathbf{h}_v^{(\ell+1)} = \operatorname{ReLU}\left(W\mathbf{h}_v^{(\ell)} + b + \sum_{u \to v} \varphi_{\mathrm{in}}\left(\mathbf{h}_u^{(\ell)}\right) + \sum_{v \to w} \varphi_{\mathrm{out}}\left(\mathbf{h}_w^{(\ell)}\right)\right), \tag*{(12)}

with φin\varphi_{\mathrm{in}}, φout\varphi_{\mathrm{out}} two-layer MLPs. In code this is A_in @ MLP_in(H) + A_out @ MLP_out(H): still just matrix multiplication. The resulting DirGINE [11] uses four layers of width 32, a sum readout and a linear classifier (17,696 parameters), and starts from constant vertex features—all the information is in the topology.

Locality is size-agnostic. Nothing in Eq. (12) refers to the number of vertices, so the same weights apply to graphs of any size.

Equivariance for free, and generalization across size

Because Eq. (12) is built only from adjacency products and position-wise maps, permutation equivariance is structural rather than learned: for any permutation matrix PP,

H(PAinPT,PAoutPT,PX)=PH(Ain,Aout,X),(13)\mathbf{H}(P A_{\mathrm{in}}P^{\mathsf{T}}, P A_{\mathrm{out}}P^{\mathsf{T}}, PX) = P\mathbf{H}(A_{\mathrm{in}}, A_{\mathrm{out}}, X), \tag*{(13)}

and the graph-level logits, obtained by a sum readout, are exactly invariant. The identity holds in exact arithmetic for any weights; measured numerically on a test quiver it holds to the last bit, both errors coming out at 0.0 rather than at the 10−810^{-8} one would accept from an approximately equivariant model. This is the sharpest illustration in the tutorial of what an inductive bias is: a property holding for every input, before training, with no data required. A model without it would have to learn Eq. (13) from examples, and would only ever hold it approximately.

Table 3: Quiver mutation-type classification (type AA versus type DD), after eleven epochs. The model is trained on 800 quivers with n=7,8n = 7, 8 and evaluated on 100 quivers with n=9n = 9, a size never seen in training. Independently of training, the node equivariance of Eq. (13) and the invariance of the graph-level logits both hold with maximum error exactly 0.0.

Evaluation setVertices nnAccuracy
Training set7, 8 (seen)100%
Test set9 (unseen)99%

Table 3.

Table 3 records the payoff. Trained only on 7 and 8 vertices, the network reaches 99% on quivers with 9—a direct consequence of locality: message passing learns a rule about neighbourhoods, and neighbourhoods do not know how large the ambient graph is. Whether the transfer degrades gracefully at substantially larger nn, and whether a fixed depth of four layers eventually becomes the binding constraint as the diameter grows, is the natural next experiment.

Continuous Data: PINNs and Rigorous Verification

The problem and the network

The third inductive bias constrains the model by a differential equation rather than a symmetry. Consider the two-point boundary value problem

−u′′(x)=π2sin⁡(πx),x∈[0,1],u(0)=u(1)=0,(14)-u^{\prime\prime}(x) = \pi^{2}\sin(\pi x), \qquad x \in[0,1], \qquad u(0) = u(1) = 0, \tag*{(14)}

whose exact solution is u(x)=sin⁡(πx)u(x) = \sin(\pi x). A physics-informed neural network [15] replaces the discretization of Eq. (4.1) by a network uθu_{\theta} trained to make the residual small,

L(θ)=1N∑i=1N∣−uθ′′(xi)−f(xi)∣2+λ(∣uθ(0)∣2+∣uθ(1)∣2),f(x)=π2sin⁡(πx).(15)\mathcal{L}(\theta) = \frac{1}{N}\sum_{i=1}^{N}\left|-u_{\theta}^{\prime\prime}(x_i)-f(x_i)\right|^{2}+\lambda\left(\left|u_{\theta}(0)\right|^{2}+\left|u_{\theta}(1)\right|^{2}\right), \qquad f(x)=\pi^{2}\sin(\pi x). \tag*{(15)}

The derivative uθ′′u_\theta'' is not a finite difference but the exact derivative of the network, obtained by composing jax.grad with itself, so Eq. (4.2) carries no discretization error at the collocation points. We take uθu_\theta to be a tanh network of shape 1→32→11 \to32 \to1 (97 parameters), N=50N = 50 collocation points uniformly spaced in [0.01,0.99][0.01, 0.99], λ=10\lambda= 10, and 10410^4 Adam steps at learning rate 10−310^{-3}. The network is deliberately shallow: the over-approximation (“wrapping”) incurred by the interval analysis of Sec. 4.2 compounds with depth, so verifiability is itself an architectural constraint.

Training converges to L=3.7×10−4\mathcal{L} = 3.7 \times10^{-4}, and uθu_\theta agrees with sin⁡(πx)\sin(\pi x) to a maximum pointwise deviation of 9.0×10−49.0 \times10^{-4} on a fine grid (Fig. 3(a),(b)). This is where most PINN demonstrations stop—and, for a problem whose exact solution is unknown, where the honest questions begin. The residual was checked at 50 points. What happens on the rest of the continuum?

Interval arithmetic: from a good fit to a proof

An interval [a,b][a,b] denotes {x∈R:a≤x≤b}\{x \in\mathbb{R} : a \le x \le b\}, and interval arithmetic propagates guaranteed enclosures through computation: [16, 17]

[a,b]+[c,d]=[a+c,b+d],[a,b]⋅[c,d]=[min⁡S,max⁡S],S={ac,ad,bc,bd}.(16)[a,b] + [c,d] = [a+c,b+d], \qquad[a,b] \cdot[c,d] = [\min S,\max S], \qquad S = \{ac,ad,bc,bd\}. \tag*{(16)}

Two points make the guarantee real rather than nominal. First, even a+ca+c is not computed exactly—IEEE 754 rounds to the nearest representable double [18]—so every lower bound is nudged down and every upper bound up by one unit in the last place (np.nextafter), and a length-kk inner product is widened by kk ULPs. Second, interval arithmetic ignores correlations between operands: x−xx-x over [0,1][0,1] returns [−1,1][-1,1], not {0}\{0\}. Enclosures are thus always valid and generally pessimistic, and controlling that pessimism is the engineering problem.

To bound uθ′′u_\theta'' over a whole subinterval we propagate the jet (u,u′,u′′)(u,u',u'') through the network in interval form—forward-mode automatic differentiation by hand, every intermediate quantity an enclosure. A linear layer z=Wu+bz = Wu + b gives z′=Wu′z' = Wu', z′′=Wu′′z'' = Wu''; for h=tanh⁡(z)h = \tanh(z), writing s=sech⁡2(z)=1−tanh⁡2(z)s = \operatorname{sech}^2(z) = 1-\tanh^2(z),

h′=sz′,h′′=−2tanh⁡(z)s(z′)2+sz′′.(17)h' = sz', \qquad h'' = -2\tanh(z)s(z')^2 + sz''. \tag*{(17)}

Each operation in Eq. (17) admits a rigorous enclosure: tanh⁡\tanh is monotone, so its enclosure is exact up to rounding; squaring is tightened by hand when the interval straddles zero; sin⁡\sin is enclosed by its endpoint values, corrected at any critical point π/2+kπ\pi/2 + k\pi inside the interval. The full scheme is Algorithm 1, closely related to interval bound propagation as used for neural network verification. [19]

What verification reveals

Running Algorithm 1 with M=104M = 10^4 certifies

∣−uθ′′(x)−f(x)∣≤7.70×10−2for every x∈[0,1],(18)\lvert-u_\theta''(x) - f(x) \rvert\le7.70 \times10^{-2} \qquad\text{for every } x \in[0,1], \tag*{(18)}

a statement about every point of the domain rather than about a finite sample. The enclosure is not loose: Fig. 3(c) shows it hugging the pointwise residual evaluated at subinterval centres, so at M=104M = 10^4 the wrapping effect has not yet swamped the estimate.

Two things follow. The first is a matter of magnitude. The converged loss L=3.7×10−4\mathcal{L} = 3.7 \times10^{-4} is dominated by its residual term, so the residual at the 50 collocation points has root-mean-square about 1.9×10−21.9 \times10^{-2}; the guaranteed worst case over the continuum, Eq. (18), is four times larger. A Algorithm 1 Rigorous residual bound for a trained PINN

Require: trained parameters θ\theta; domain [0,1][0,1]; subdivision count MM

Ensure: ρ\rho with ∣−uθ′′(x)−f(x)∣≤ρ\lvert-u_\theta''(x)-f(x)\rvert\le\rho for every x∈[0,1]x\in[0,1]

  1. partition [0,1][0,1] into MM intervals ImI_m of width 1/M1/M

  2. for each ImI_m (vectorized over mm) do

  3. initialize the jet (u,u′,u′′)←(Im,[1,1],[0,0])(u,u',u'')\leftarrow(I_m,[1,1],[0,0])

  4. for each layer do

  5. propagate (u,u′,u′′)(u,u',u'') by Eq. (17) in interval arithmetic with outward rounding

  6. end for

  7. Rm←(−u′′)−π2⋅IntervalSin⁡(πIm)R_m\leftarrow(-u'')-\pi^2\cdot\operatorname{IntervalSin}(\pi I_m)

  8. end for

  9. return ρ←max⁡mmax⁡(∣Rm∣,∣Rm‾∣)\rho\leftarrow\max_m\max(\lvert R_m\rvert,\lvert\overline{R_m}\rvert)

Figure 3. (a) The trained PINN against the exact solution sin⁡(πx)\sin(\pi x). (b) Training loss. (c) The interval enclosure of the residual −uθ′′−f-u_\theta''-f over 10410^4 subintervals (band) against the pointwise residual at subinterval centres (line). The enclosure is tight; the residual oscillates within about 3×10−23\times10^{-2} across the interior and rises steeply at both endpoints.

training curve that has flattened at 10−410^{-4} is reporting an average over the points it was given, and averages over samples are not bounds.

The second is a matter of shape. The residual is far from uniform (Fig. 3(c)): it oscillates between about ±3×10−2\pm3\times10^{-2} across the interior, through five local extrema, and then rises steeply within the outermost few per cent at each end, attaining its maximum at x=0x=0 and x=1x=1. A sufficiently dense pointwise scan would suggest the same picture; what the interval computation adds is the guarantee that the bound holds between the sample points too, so the maximum cannot be hiding in a gap the scan stepped over. This is the practical argument for verification over validation: sampling tells you about the samples.

Every quantity entering Eq. (18) is an interval computation with outward rounding. Granted that the library’s tanh⁡\tanh and sin⁡\sin are accurate to within the one unit in the last place by which each enclosure is widened, the inequality is therefore a statement about the trained network rather than a statistic—and, unlike the 9.0×10−49.0\times10^{-4} deviation of Sec. 4.1, it is obtained without any knowledge of the exact solution. Converting a residual bound of this kind into a bound on ∥u−uθ∥\lVert u-u_\theta\rVert, and sharpening the constants involved, is a subject in its own right. [20]

Discussion

Three data types, three inductive biases, three kinds of payoff. For the sequential data of Sec. 2, matching architecture to structure bought generalization: at identical parameter budget, weight sharing cut the train–test gap from 0.87 points to 0.03, and saliency confirmed the network weighting the primes where the murmuration signal lives. For the graph data of Sec. 3, it bought an exact guarantee: permutation equivariance held to machine zero before a single gradient step, and locality carried a model trained on 7 and 8 vertices to 99% on 9. For the continuous data of Sec. 4, it bought verifiability: because the model is a small smooth function of one variable rather than a lookup table, interval arithmetic bounded its residual at every point of the domain—and that guaranteed bound turned out to be four times the residual the training loss was reporting.

These are not three tricks but one habit. Before choosing a model, ask what the data is invariant under, what it is indexed by, and what equations it satisfies; then pick the architecture that already respects those answers. In mathematics the answers are unusually well specified—the symmetry group, the differential equation, the irrelevance of vertex labels—and that specificity is an advantage the field should spend rather than ignore.

Several directions follow. The rank task should be pushed where architecture separates models more sharply: higher ranks, larger conductors, or restriction to the small primes where the signal concentrates. For the mutation classifier, the obvious tests are more Dynkin types, larger quivers, and explainability methods in the spirit of Ref. 11. The verification pipeline of Sec. 4 has the broadest reach: rigorous a posteriori certification of learned objects—solutions of differential equations, but equally metrics, forms and other geometric data produced by networks—is where machine learning and mathematics can meet without either giving up its standards of proof.

The three tutorial notebooks (block1_sequential.ipynb, block2_graph.ipynb, block3_pinn.ipynb), together with the elliptic curve dataset and Colab links, are available at https://github.com/yidiq7/Banff-Tutorial-Architecture. Each is self-contained, depends only on JAX, NumPy and Matplotlib, and runs on CPU in minutes.

Acknowledgments

The author thanks the DANGER organizers—Edward Hirst, Elli Heyes, Miranda Cheng and Sergei Gukov—for the invitation and for assembling such a stimulating meeting, and the tutorial participants for questions that sharpened several of the points above.

ORCID

Yidi Qi – https://orcid.org/0000-0002-2094-0257

Tutorial 3: Tips and tricks for analyzing and presenting machine learning results

Jessica N. Howard

These lecture notes summarize the main points from the third tutorial session of the workshop “DANGER: Data, Numbers, and Geometry” held in April 2026 at the Banff International Research Station for Mathematical Innovation and Discovery (BIRS). The accompanying code and slide presentation can be found at jnhoward/Banff-Tutorial/.

Tutorial 3: Tips and tricks for analyzing and presenting machine learning results

Introduction

At its core, Machine Learning (ML) is an incredibly powerful tool because of its ability to extract high-dimensional, non-linear relationships between features in data.1 But the high dimensionality and probabilistic nature of data pose two key challenges:

  1. High →\to Low: Ultimately, we need to compress our machine-learned relationships into much lower dimensional spaces. This is partly because we can only really think intuitively in low dimensions (2, 3, maybe 4), making this dimensionality reduction useful for interpretation. More pragmatically, we also have to represent these machine-learned relationships in two-dimensional plots that we can use in papers. Therefore, we typically rely on summary metrics to understand our high-dimensional, machine-learned results.

  1. Uncertainties and generalizability: If an ML model trains on certain random samples of data, will the learned relationships still work on new random samples? What are the statistical uncertainties we can expect on the summary metrics?

The goal of these notes is to provide a brief survey of common techniques and best practices to approach these challenges. The target audience are individuals who are just getting started with ML. Thus, we limit our scope to introductory concepts, but will include references where one can learn more. The reader should be familiar with basic ML terminology such as loss function and training/validation/testing data split.

Summary Metrics for Common ML Tasks

A trained ML model typically defines a high-dimensional relationship that cannot be inspected directly. Summary metrics are low-dimensional representations of model performance. Note that the loss function used to train your ML model is one such low-dimensional representation. However, it is generally advantageous to look at other metrics in addition to the loss function to fully assess performance.

The appropriate metric(s) depends strongly on the type of ML task. We can generally split ML tasks into three categories: (1) Generative modeling, (2) Regression, (3) Classification. We will briefly cover common summary metrics for (1) and (2) and then do a much deeper dive on (3) in Section 3 since it is the most theoretically well-understood case.

Generative Modeling Task

For a generative modeling task, the objective is to learn a model distribution pmodel(x)p_{\mathrm{model}}(x) that approximates the target distribution ptarget(x)p_{\mathrm{target}}(x). For example, a model that generates images of cats is implicitly learning the distribution of all possible cat images. Evaluating such a model therefore requires a summary metric that quantifies the difference between the model and target distributions.

It turns out there are not many ways to robustly compare two high-dimensional probability distributions. One can use distance metrics such as Maximum Mean Discrepancy (MMD) [3], which is an integral probability metric that measures the largest difference between expectations over kernel functions within a chosen class, or Optimal Transport distances [4], which quantify the cost of transforming pmodelp_{\mathrm{model}} into ptargetp_{\mathrm{target}}. Another approach is to train a classifier to distinguish model-generated samples from target samples [5]. This works because an optimal classifier is closely related to the likelihood ratio between the two distributions. If the distributions have overlapping support and their probability densities can be estimated, one may also use ff-divergences such as the Kullback-Leibler (KL) divergence [6]. However, reliable density estimation may require many samples, particularly in high dimensions.

Given the limited number of options, it is common for one of these metrics to already appear in the model’s training loss. Thus, ideally, model performance should be evaluated using another metric as well.

Regression Task

For a regression task, the objective is to learn a function, fmodel(x)f_{\mathrm{model}}(x), that approximates the target function, ftarget(x)f_{\mathrm{target}}(x), across the domain of xx. For continuous outputs, such as predicting the age of a cat from an image, a common summary metric is the Mean Squared Error (MSE),

MSE=1n∑i[fmodel(xi)−ftarget(xi)]2,(19)\mathrm{MSE} = \frac{1}{n}\sum_i \left[f_{\mathrm{model}}(x_i)-f_{\mathrm{target}}(x_i)\right]^2, \tag*{(19)}

which measures the average squared difference between the predicted and target values. When the target values have known uncertainties, σi\sigma_i, these differences can instead be weighted to calculate the chi-squared statistic,

χ2=∑i[fmodel(xi)−ftarget(xi)]2σi2.(20)\chi^2 = \sum_i \frac{\left[f_{\mathrm{model}}(x_i)-f_{\mathrm{target}}(x_i)\right]^2}{\sigma_i^2}. \tag*{(20)}

If every σi=1\sigma_i = 1, this becomes the residual sum of squares.

Categorical outputs, such as the eye color of the cat in the image, can be represented numerically using one-hot encoding and compared using similar metrics (e.g. MSE). Namely, given an image, xx, say the true color of the cat’s eyes is “Teal”. We can turn this label into a continuous vector,

Teal  →  (1,0,…,0)∈RNclasses(21)\mathrm{Teal} \;\to\; (1,0,\ldots,0)\in\mathbb{R}^{N_{\mathrm{classes}}} \tag*{(21)}

where NclassesN_{\mathrm{classes}} is the number of categories, which in this case is the number of possible cat eye colors. In practice, however, categorical labels are usually best treated in a multi-class classification setup.

Regression vs Classification

When the task is categorical in nature, regression and classification become very similar. And in fact, one could learn to classify data by regressing the encoded class label vectors. In this case, the model would output a continuous vector which is then matched to the appropriate unit target vector via an MSE loss.

On the other hand, a classification model’s output is typically interpreted as a categorical distribution across the model classes. In this case, it is advantageous to change our loss function to categorical cross-entropy (i.e. cross entropy evaluated on these categorical distributions).2 For example, when trying to match the correct label vector (1,0,…,0)(1, 0, \ldots, 0) a regression algorithm may predict (1,0.1,0,…,0)(1, 0.1, 0, \ldots, 0) while a classification algorithm may predict (0.9,0.1,0,…,0)(0.9, 0.1, 0, \ldots, 0) which is appropriately normalized. Of course, one could also use MSE on this normalized vector, but cross-entropy turns out to work better in practice. Using MSE to train a classifier in this case will result in slower convergence during training due to vanishing gradients [6, 7, 8].

Binary Classification Analysis: From Scores to ROC Curves

Our task will be to assign one of two labels to each data point xx. We will call the two classes A and B. Let C(x)C(x) be a binary classifier which assigns an example data point, xix_i, a one-dimensional score, C(xi)=siC(x_i) = s_i. Note that this score need not be a strict probability [9]. However, we will interpret higher (lower) scores as indicating that xix_i belongs to class B (class A). But how large is large enough to be considered as belonging to class B? Ultimately, we need to turn this continuous score into a binary decision about the identity of xix_i. We can do this by imposing a threshold defining what is “B enough”. Changing this threshold will produce different labels for the same xix_i. The goal is to optimize this choice so that the predicted labels are as close as possible to the true ones.

Score Thresholds and the Confusion Matrix

After choosing a threshold, the data points, xix_i, with scores, sis_i, above the threshold, TT, are classified as B (“accepted”), while those below it are classified as A (“rejected”). The True Positive Rate (TPR) is the fraction of actual B data points above the threshold, and the False Negative Rate (FNR) is the fraction of actual B data points below it, so that TPR + FNR = 1. Similarly, the False Positive Rate (FPR) is the fraction of actual A data points above the threshold, while the True Negative Rate (TNR) is the fraction below it, with FPR + TNR = 1. This naming comes from medical fields where the goal is usually to test for a particular disease. Thus, the two classes are “Positive” and “Negative” instead of B and A.

These four quantities can be used to form the confusion matrix,

(TPFNFPTN)=(TPR NBFNR NBFPR NATNR NA)(22)\begin{pmatrix} \mathrm{TP} & \mathrm{FN} \\ \mathrm{FP} & \mathrm{TN} \end{pmatrix} = \begin{pmatrix} \mathrm{TPR}\ N_{\mathrm{B}} & \mathrm{FNR}\ N_{\mathrm{B}} \\ \mathrm{FPR}\ N_{\mathrm{A}} & \mathrm{TNR}\ N_{\mathrm{A}} \tag*{(22)} \end{pmatrix}

where NBN_{\mathrm{B}} (NAN_{\mathrm{A}}) is the number of B (A) data points in the sample. The confusion matrix summarizes the classifier’s behavior at a particular threshold. Several named metrics can be derived from this such as accuracy =TP+TNNB+NA= \frac{\mathrm{TP}+\mathrm{TN}}{N_{\mathrm{B}}+N_{\mathrm{A}}} and F1-score =2TP2TP+FP+FN= \frac{2\mathrm{TP}}{2\mathrm{TP}+\mathrm{FP}+\mathrm{FN}}.

In high-energy particle physics terminology, the classes are BB = signal and AA = background. Thus, the TPR is also called the signal efficiency, ϵS\epsilon_S, since it is the amount of signal accepted. Similarly, the FPR is the background efficiency, ϵB\epsilon_B, and the TNR is the background rejection rate, 1−ϵB1-\epsilon_B.

The Receiver Operating Characteristic (ROC) Curve

Figure showing how a ROC curve can be constructed from a score distribution

Figure 1 (PDF p. 23). Figure showing how a ROC curve can be constructed from a score distribution. Various threshold values are swept from right to left. For each threshold the TPR (fraction of class B scores falling above the threshold) and TNR (fraction of class A scores falling below the threshold) are measured. These (TPR, TNR) points are collected to form the ROC curve. The points on the ROC curve corresponding to the three thresholds are indicated.

Varying the score threshold changes the tradeoff between TPR and TNR. Consider the example in Fig. 1 which shows three possible thresholds. Threshold 1 rejects all data points, giving (TPR, TNR) = (0, 1). At the opposite extreme, threshold 3 accepts all data points, giving (TPR, TNR) = (1, 0). Threshold 2 provides a more useful compromise, accepting 0.31 of the B data points while rejecting 0.946 of the A data points. Continuously moving the threshold from right to left traces out the receiver operating characteristic (ROC) curve, which summarizes the available tradeoffs between signal acceptance and background rejection.

A common single-number summary of the ROC curve is the area under the curve (AUC). An ideal classifier has AUC = 1, while random guessing gives an AUC = 0.5. While useful, the AUC can have some drawbacks since it is compressing the entire ROC curve into a single number. Importantly, it does not indicate which threshold should be used. Two classifiers might have the same AUC but one may be more performant for a particular threshold of interest (for example very high TNR). Ideally, one can compare ROC curves directly, however when testing many models at once this can quickly become cumbersome. So AUC is used as a standard proxy for performance, however it can be useful to look at additional ROC-derived metrics.

Conventions and Alternate Visualizations

Typically, you will see ROC curves displayed as either FPR on the horizontal axis and TPR on the vertical axis or TPR on the horizontal axis and TNR on the vertical axis. The latter is particularly common in experimental high-energy particle physics. However, the majority of state-of-the-art ML papers tend to plot an alternate ROC curve: TPR on the horizontal axis and 1/FPR1/\mathrm{FPR} on the vertical axis. This alternative display is particularly useful when comparing classifiers which have started to saturate performance (AUC ≳0.90\gtrsim0.90) since it will accentuate small, yet significant, differences.

Extending to Multiple Classes

Multi-class classification extends binary classification to problems with more than two possible category labels. The primary change occurs in the loss function where we now use categorical cross-entropy [6],

LCE=−∑c=1Nclassesqclog⁡(pc)(23)\mathcal{L}_{\mathrm{CE}}=-\sum_{c=1}^{N_{\mathrm{classes}}}q_c\log(p_c) \tag*{(23)}

where NclassesN_{\mathrm{classes}} is the number of classes, qcq_c is the true label (i.e. 1 or 0), and pc∈(0,1]p_c \in(0,1] is the predicted probability for class cc. For example, say we have Nclasses=3N_{\mathrm{classes}}=3. For a data point xix_i we have (q1,q2,q3)=(1,0,0)(q_1,q_2,q_3)=(1,0,0), meaning it belongs to class 1. And say our classifier predicts (p1,p2,p3)=(0.9,0.09,0.01)(p_1,p_2,p_3)=(0.9,0.09,0.01). Then the categorical cross-entropy is −log⁡(0.9)=0.1054-\log(0.9)=0.1054. When Nclasses=2N_{\mathrm{classes}}=2 categorical cross-entropy simply reduces to the binary case. For visualizing the results, performance is often analyzed through pairwise comparisons. For each matchup we can then construct ROC curves as in the binary case.

Statistical Uncertainties and Dealing with Limited Data

The metrics that we calculate inherit randomness from the data we use to calculate them. So we can ask questions like, “how likely was it that we got a particular AUC value?” and “what happens if we used a larger data sample?”. In other words, what are the statistical properties of our metrics?

Metrics as Random Variables

Any performance metric MM will be estimated from a finite test set, X={x1,…,xn}→M^(X)X=\{x_1,\ldots,x_n\}\to\widehat{M}(X). Since XX is a random variable, M^(X)\widehat{M}(X) will be as well. Thus, a different sample, XjX_j, drawn from the same underlying distribution will generally produce a different value of M^j=M^(Xj)\widehat{M}_j=\widehat{M}(X_j). This means the estimate M^≈M\widehat{M}\approx M will have a statistical uncertainty coming from the randomness in XX.

We can imagine calculating M^j\widehat{M}_j for many different XjX_j samples and forming a histogram of the values. From this we can then ask about the statistical properties of the distribution of M^\widehat{M} values. For example, what is the average and standard deviation of this distribution? How likely is a particular value? Ultimately, this will help us infer what the true value of MM is most likely to be.

This process is best illustrated via a classic example from statistics: estimating the standard error on the mean. In this case, our metric MM is the true mean, μ\mu, of a distribution, p(z)p(z). From a random sample Zj={z1,…,zn∣zi∼p(z)}Z_j=\{z_1,\ldots,z_n\mid z_i\sim p(z)\}, we can get an estimate of the mean as μ^j=1n∑i=1nzi\widehat{\mu}_j=\frac{1}{n}\sum_{i=1}^{n}z_i. We can repeat this for different ZjZ_j to get a distribution of μ^\widehat{\mu} values. Alternatively, we could think of this as sampling some distribution q(μ^)q(\widehat{\mu}). For sufficiently large nn we know that q(μ^)q(\widehat{\mu}) will be approximately normally distributed for any well-behaved p(z)p(z) by the Central Limit Theorem (CLT). Let μ0\mu_0 (σ02\sigma_0^2) be the true mean (variance) of q(μ^)q(\widehat{\mu}). Then the original mean of p(z)p(z) can be estimated as μ=μ0±σ0\mu=\mu_0\pm\sigma_0. Here, σ0\sigma_0 is known as the standard error on the mean. The same procedure works for other metrics. In general, let μ0,σ02\mu_0,\sigma_0^2 be the true mean and variance of the distribution of estimates, q(M^)q(\widehat{M}), of a metric MM. Then we say that M=μ0±σ0M=\mu_0\pm\sigma_0.

We can estimate μ0\mu_0, σ02\sigma_0^2 in practice by constructing an empirical estimate of q(M^)q(\hat{M}). When sufficient independent data are available, μ0\mu_0, σ02\sigma_0^2 can be estimated by dividing the data into NN independent test sets, X1,…,XNX_1,\ldots,X_N, each containing nn data points, and evaluating the metric on each set. The resulting ensemble {M^1,…,M^N}\{\hat{M}_1,\ldots,\hat{M}_N\} can then be used to estimate both the expected metric value and its variance,

μ^0=1N∑jM^jandσ^02=1N∑j(M^j−μ^0)2.(24)\hat{\mu}_0 = \frac{1}{N}\sum_j \hat{M}_j \quad\text{and}\quad\hat{\sigma}_0^2 = \frac{1}{N}\sum_j\left(\hat{M}_j-\hat{\mu}_0\right)^2 . \tag*{(24)}

such that now M≈μ^0±σ^0M \approx\hat{\mu}_0 \pm\hat{\sigma}_0.

This procedure is preferable when feasible, but it requires a total of NnNn independent samples. In practice, one typically would like at least N≳5N \gtrsim5 and n≳30n \gtrsim30. The latter is a familiar rule-of-thumb for when q(M^)q(\hat{M}) will be approximately Gaussian by the CLT, however it depends heavily on the test statistic and assumes that the distribution is reasonably well-behaved. Practically, nn will usually be far larger. And, in general, the larger nn and NN are, the better since substantially larger test sets provide more reliable estimates of μ0\mu_0 and σ02\sigma_0^2. Concretely, in ML applications one can expect n=103−105n = 10^3 - 10^5 and N=5−10N = 5 - 10. In cases where there is a limited amount of independent data, one must employ resampling methods to construct q(M^)q(\hat{M}).

Resampling Methods

When independent test data are limited, resampling methods provide an alternative way to construct an ensemble of test sets X1,…,XNX_1,\ldots,X_N from a single sample X=x1,…,xnX = x_1,\ldots,x_n. Note that these methods still assume that nn is sufficiently large for the empirical distribution of XX to approximate the underlying distribution p(x)p(x) reasonably well. Moreover, XX must contain held-out test data only; none of its observations should have been used to train the model or select its architecture and hyperparameters during validation. Two common resampling methods are the bootstrap and the jackknife [10].

In bootstrap resampling, each new test set XjX_j is constructed by drawing nn observations from XX with replacement. Consequently, some observations may appear multiple times in a bootstrap sample, while others may not appear at all. The metric is evaluated on these bootstrapped samples, and the resulting values {M^1,…,M^N}\{\hat{M}_1,\ldots,\hat{M}_N\} are used to estimate μ0\mu_0 and σ02\sigma_0^2.

In Jackknife resampling, we instead construct nn test sets of size n−1n - 1. Each set is formed by leaving out a different observation from XX, so that every observation is omitted exactly once. For example X1={x2,…,xn}→M^1X_1 = \{x_2,\ldots,x_n\} \to\hat{M}_1. Therefore, we evaluate the metric on N=nN = n sets of samples. The Jackknife estimates are then

Mˉ=1n∑jM^j\bar{M} = \frac{1}{n}\sum_j \hat{M}_j
σjack2=n−1n∑j(M^j−Mˉ)2(25)\sigma_{\mathrm{jack}}^2 = \frac{n-1}{n}\sum_j\left(\hat{M}_j-\bar{M}\right)^2 \tag*{(25)}
bjack=(n−1)(Mˉ−M^).b_{\mathrm{jack}} = (n-1)\left(\bar{M}-\hat{M}\right) .

where M^\hat{M} is the metric evaluated on all nn samples (i.e. X→M^X \to\hat{M}) and bjackb_{\mathrm{jack}} is the Jackknife estimated bias. Then, μ^0=Mˉ−bjack\hat{\mu}_0 = \bar{M} - b_{\mathrm{jack}} and σ^02=σjack2\hat{\sigma}_0^2 = \sigma_{\mathrm{jack}}^2 [10].

The exercise in Section 6.2 compares both of these resampling methods to the method of splitting the test data into independent sets. For details on the tradeoff between bootstrap and jackknife resampling see Refs. [10, 11].

Plot Design: Effectively Communicate Scientific Results

Plots are an incredibly efficient and effective way to communicate your scientific results. Thus, it is worth taking the time to carefully design a paper’s plots. Doing so will ensure that the impact of your science is clear.

This section covers what questions you should ask yourself in choosing how to present your results. In ML, this is particularly challenging because we are significantly reducing the dimensionality of our solution and are often comparing many models and metrics at once.

Questions to ask yourself

Every plot should tell a story, and the goal is to identify the most concise and compelling way to tell it. When designing a plot, ask what the most important take-away messages are and which relationships among the results should be emphasized. It is also useful to distinguish between information that must be shown graphically and information that can be stated more efficiently in the text. Because figures may be the first (and sometimes only) part of a paper that a reader examines closely, this process deserves considerable time and care.

The format of the paper also imposes practical constraints. For example, whether the paper uses a single- or double-column layout determines which figure dimensions will remain legible. The appropriate type of visualization should likewise be chosen based on the scientific message. A standard two-dimensional plot is often the clearest option, while a color map can encode a meaningful third variable. Fully three-dimensional plots can also work, however the final visual representation depends significantly upon the 2D projection that is taken. Thus, as a rule of thumb, three-dimensional plots should be used only when the added dimension is essential to understanding the result. Additionally, care should be taken in selecting the projection plane that most effectively communicates the relationship.

As an example, consider the learning curves in Fig. 2, which show the loss as a function of the amount of training data for two MNIST classification tasks [12]. The plot communicates three principal conclusions: the theoretical predictions agree closely with the empirical measurements, the losses exhibit semi power-law behavior, and the two classification tasks follow quantitatively different trends. Features such as the logarithmic axes, distinct colors for each task, error bars, and consistent representations of theory and empirical results make these conclusions visible without requiring the reader to reconstruct them from the surrounding text.

Examples of Common Situations

Here, we will cover some common scenarios one might encounter and possible ways to address them. First, you will likely be in a situation where there are far too many things to plot. As a rule of thumb, plots will start to look too busy if there are more than 3-4 distinct lines. When this happens, ask which pairwise relationships are the most important to highlight to make the scientific point. Then, try to split these comparisons into multiple plots or choose a representative comparison and say the rest in words. See Fig. 3 for an example of this.

Another common situation is when you want to show the agreement between two quantities (for example theoretical prediction and empirical result) but the difference between them is much smaller than the overall shape. In the case where both the shape and agreement are important, one can add a residual plot. This residual plot shows the difference or ratio of the two quantities below the main plot. See Figure 4 for an example.

Two examples of residual plots

Figure 4. Figure showing two examples of residual plots. When you want to show agreement between two quantities (in this case binned data and the best fit function) but also want to show the overall shape, it can be helpful to use a residual plot. In the main plot, we show the fitted function and binned data to give an idea of the agreement and shape of the distribution. However, more information about the fit can be gained by looking at the difference or ratio of the two quantities. This can be shown in a residual plot below the main plot. In this case, it helps accentuate differences happening at the tails of the distribution which would be difficult to notice otherwise.

Loss versus amount of data for MNIST classification tasks

Figure 2 (PDF p. 27). Example of how a plot can be used to efficiently tell a story. We have modified a figure from Ref. [12] to convey three key points about the result: (1) theoretical predictions agree closely with the empirical measurements, (2) the losses exhibit semi power-law behavior, (3) the two classification tasks follow quantitatively different trends.

Plot Accessibility

An important, but often neglected, aspect of plot design is accessibility. Labels, legends, and axis ticks should be large and clear enough to read at the figure’s final printed size. Figures should include descriptive captions that explain not only what is displayed, but also the principal trends and conclusions the reader should draw from the plot. It is also important to note that the typical PDF files generated (e.g. by LaTeX) are not automatically compatible with accessibility tools such as screen readers. See Ref. [14] for an AI workflow to convert a PDF file into an accessible version.

Color choices require particular care [15] since plots should remain interpretable for readers with different forms of color vision deficiency (CVD). Ideally, information should not be encoded through color alone; instead, distinct markers or line styles should be used to provide redundant visual cues. Tools such as DaltonLens [16] and Coblis [17] can simulate different forms of CVD and help identify potential accessibility problems before publication. Color maps should also be perceptually uniform so that features are not artificially accentuated. Finally, because papers are still frequently printed in black and white, every figure should be checked in grayscale to ensure that its conclusions remain clear.

Figure showing a potential fix for a plot with too many lines

Figure 3 (PDF p. 28). Figure showing a potential fix for a plot with too many lines. The primary goal of the plot is to show that “2D2\mathrm{D}” methods perform worse than “2DΔpT2\mathrm{D}_{\Delta p_T}” methods across all choices of NN. However, the plot is trying to do too many pairwise comparisons at once. Since this performance gain is present for all methods (minOT, QminOT 1%, and QminOT 10%), we can simply choose a representative method (in this case QminOT 1%) and say that we see a similar trend in the other methods in the caption. If comparing the performance of the three methods is also important, one can show this in a separate plot. The data and methods for this example were taken from Ref. [13].

Coding Exercises

In this section we describe the coding exercises included in the tutorial. The corresponding code notebooks are available at jnhoward/Banff-Tutorial/. Brief solutions to the questions in the exercises are given in A.

Exercise: Build Your Own ROC Curve

Write a function that calculates a ROC curve and verify it against the built-in functions in the scikit-learn library [18]. Once you have finished, test your intuition by answering the following questions: (1) What score distributions would lead to an AUC of 0.5 (random guessing)? (2) What score distributions would lead to an AUC of 1 (perfect classifier)? (3) What is the meaning of an AUC that is less than 0.5?

Exercise: Estimate the Uncertainty

Write a function that implements jackknife resampling. For a set of mystery data, X={x1,…,xn∣xi∼p(x)}X = \{x_1, \ldots, x_n \mid x_i \sim p(x)\}, estimate the mean of p(x)p(x) and the standard error on the mean. Estimate these quantities three ways: (1) using separate samples, (2) using bootstrap resampling, (3) using your jackknife resampling function. How close are the methods to each other? To the true value?

Acknowledgments

A huge thank you to Edward Hirst and Elli Heyes for organizing this session and encouraging us to write up our tutorials. And thanks to my fellow session leads Tomás S. R. Silva and Yidi Qi

for helping make these tutorials a success. JNH is supported by the National Science Foundation under Grant No. NSF PHY-2309135 and by a UCSB Chancellor’s Postdoctoral Fellowship.

ORCID

Jessica N. Howard - https://orcid.org/0000-0001-8295-7727

Exercise Solutions

Build Your Own ROC Curve

  1. What score distributions would lead to an AUC of 0.5 (random guessing)? If the score distributions of both classes are perfectly overlapped every threshold will have the same TPR and FPR. Thus, the ROC curve will be a straight line from (TPR, TNR) = (0, 1) to (TPR, TNR) = (1, 0) with an integrated area (AUC) of 0.5.

  1. What score distributions would lead to an AUC of 1 (perfect classifier)? If the score distributions of class B and class A are separated by a gap and the B scores are all greater than the A scores, then any threshold in (or above) the gap will have TNR = 1.

  1. What is the meaning of an AUC that is less than 0.5? This simply means that the order of the distributions is inverted (A scores are greater than B scores). However, one can still effectively separate B vs A with this classifier. In the extreme case, we could have a gap between B and A, in which case the AUC is 0 but we have a perfect (inverse) classifier.

Estimate the Uncertainty

The distribution p(x)p(x) is a normal distribution with mean μ=1.4\mu= 1.4 and variance σ2=4\sigma^2 = 4. The mystery data was generated by drawing n=500n = 500 samples. Since p(x)p(x) is Gaussian distributed we know theoretically that the true standard error on the mean should be σn=0.0894\frac{\sigma}{\sqrt{n}} = 0.0894. Thus, the correct answer is μ0,σ0=1.4,0.0894\mu_0, \sigma_0 = 1.4, 0.0894.

However, one will find that the estimates all predict an inaccurate μ^\hat{\mu} due to the small number of samples available. Using N=5N = 5 independent test sets has the largest uncertainty on its prediction. It predicts μ^=1.2701±0.1208\hat{\mu} = 1.2701 \pm0.1208, making the true value just slightly one standard deviation above this prediction. Using N=1000N = 1000 bootstrapped samples, the Bootstrap resampling strategy predicts μ^=1.2712±0.0851\hat{\mu} = 1.2712 \pm0.0851. It is more sure of its prediction which falls similarly far below the truth. The Jackknife resampling strategy is the most overconfident, predicting μ^=1.2701±0.0076\hat{\mu} = 1.2701 \pm0.0076.

This illustrates the risks when dealing with limited data and indicates that n=500n = 500 is too little to accurately approximate p(x)p(x). Resampling this empirical distribution exacerbates this effect. It also affirms that the most conservative estimates will come from using separate test sets. Thus, this is the primary strategy used in ML results, but it relies on the fact that there is typically plenty of independent data.

References

  1. [1]Y. LeCun, C. Cortes and C. Burges, Mnist handwritten digit database, AT & T Labs 2 (2010).
  2. [2]A. Krizhevsky, Learning multiple layers of features from tiny images, University of Toronto (2009).
  3. [3]A. Gretton, K. M. Borgwardt, M. J. Rasch, B. Schölkopf and A. Smola, A kernel two-sample test, Journal of Machine Learning Research 13(25) (2012) 723–773.DOI
  4. [4]R. Flamary, N. Courty, A. Gramfort, M. Z. Alaya, A. Boisbunon, S. Chambon, L. Chapel, A. Cornelios, K. Fatras, N. Fournier, L. Gautheron, N. T. Gayraud, H. Janati, A. Rakotomamonjy, I. Redko, A. Rolet, A. Schutz, V. Seguy, D. J. Sutherland, R. Tavenard, A. Tong and T. Vayer, Pot: Python optimal transport, Journal of Machine Learning Research 22(78) (2021) 1–8.
  5. [5]T. Plehn, A. Butter, B. Dillon, T. Heimel, C. Krause and R. Winterhalder, Modern Machine Learning for LHC Physicists (11 2022).arxiv.org/abs/2211.01421
  6. [6]I. Goodfellow, Y. Bengio and A. Courville, Deep Learning, (MIT Press, 2016). http://www.deeplearningbook.org.
  7. [7]A. S. Bosman, A. Engelbrecht and M. Helbig, Visualising basins of attraction for the cross-entropy and the squared error neural network loss functions, Neurocomputing 400 (2020) 113–136.arxiv.org/abs/1901.02302
  8. [8]P. Golik, P. Doetsch and H. Ney, Cross-entropy vs. squared error training: a theoretical and experimental comparison,, Proceedings of the Annual Conference of the International Speech Communication Association, INTERSPEECH (08 2013) 1756–1760.DOI
  9. [9]T. Fawcett, An introduction to roc analysis, Pattern Recognition Letters 27(8) (2006) 861–874, ROC Analysis in Pattern Recognition.DOI
  10. [10]B. Efron, The Jackknife, the Bootstrap and Other Resampling Plans (Society for Industrial and Applied Mathematics, 1982).
  11. [11]B. Efron, Bootstrap methods: Another look at the jackknife, The Annals of Statistics 7(1) (1979) 1–26.
  12. [12]J. N. Howard, R. Jefferson, A. Maiti and Z. Ringel, Wilsonian renormalization of neural network Gaussian processes, Mach. Learn. Sci. Tech. 6(2) (2025) p. 025038.DOI
  13. [13]N. Craig, J. N. Howard and H. Li, Exploring Optimal Transport for Event-Level Anomaly Detection at the Large Hadron Collider (1 2024).arxiv.org/abs/2401.15542
  14. [14]K. N. Abazajian, A visual ai solution for ada compliance, AI workflow for generating ADA compliant PDF files.
  15. [15]F. Crameri, G. E. Shephard and P. J. Heron, The misuse of colour in science communication, Nature Communications 11 (Oct 2020) p. 5444.DOI
  16. [16]Daltonlens: Online color blindness simulators, Online color-vision-deficiency simulator.
  17. [17]Coblis: Color blindness simulator, Online color-vision-deficiency simulator.
  18. [18]F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot and E. Duchesnay, Scikit-learn: Machine learning in Python, Journal of Machine Learning Research 12 (2011) 2825–2830.arxiv.org/abs/1201.0490

Paper details

vlnc:W_38a35umy
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents