Compress, then regress: a surrogate for the solved game

Learning the solution of 501 for any throw, with principal components and Gaussian processes, and what the components turn out to mean

25 min read#darts, #machine learning
Contents

Why a surrogate?

Every strategy in this series comes from an exact solve: value iteration over every state of a leg of 501501, for one particular way of throwing. A solve takes several seconds, and produces 15,90215{,}902 numbers: the expected number of visits Alice needs to finish from every reachable state.

This works well when we know how Alice throws, but not when we don’t. In the last post, the belief about Alice’s throw was a cloud of 512512 candidate throws, each needing its own solution at every decision. In an app, moving a slider that changes the shape of the throw needs a new solution every time. Neither can wait several seconds for each throw.

This is a familiar problem in the computer experiments literature: an expensive, deterministic simulator, with a low-dimensional input and a high-dimensional output, that we want to evaluate quickly anywhere in its input space. The standard answer is an emulator (or surrogate): fit a statistical model to a few hundred runs of the simulator, and use the model instead. This post describes the one I built for 501501, which compresses the solutions with principal components and regresses each component on the throw with a Gaussian process. It is accurate enough that decisions made from it lose 0.00010.0001 visits per aim, its error bars can be trusted, and its components turn out to have clean interpretations: one of them has rediscovered the geometry of the double ring.

What to learn, and what not to

A state xx of the game is the score left, which dart of the visit is in Alice’s hand, and the score the visit started on. For a throwing distribution θ\theta, the expected number of visits to finish after aiming at point aa is

Qθ(x,a)=c(x)+∑oPθ(o∣a) Vθ(x′(x,o)),Q_\theta(x, a) = c(x) + \sum_o P_\theta(o \mid a)\, V_\theta\big(x'(x, o)\big),

where:

  • oo is the outcome of the dart, and x′(x,o)x'(x, o) is the state it leads to,
  • c(x)c(x) is the cost of the dart: one at the start of a visit, and nothing otherwise,
  • VθV_\theta is the value of each state under optimal play.

Only two pieces of this depend on the throwing distribution, and they are very different:

  • The outcome probabilities Pθ(o∣a)P_\theta(o \mid a) are physics: the throwing density convolved with the board. They can be computed exactly for any throw with a handful of FFTs, in well under a second.
  • The values VθV_\theta are the expensive part, a full solve of the Markov decision process. But they are a fixed-length vector of 15,90215{,}902 numbers, and they should be a smooth function of θ\theta.

So the surrogate learns θ↦Vθ\theta \mapsto V_\theta only, and every decision combines learned values with exact probabilities. A good surrogate for VV then makes exactly the decisions an exact solve would, as long as its errors do not change which aim minimises QQ.

There is one more thing that never needs to be learned. If Alice’s darts are pulled by bb, aiming at aa lands where aiming at a+ba + b would land without the pull, so

Qθ,b(x,a)=Qθ,0(x,a+b).Q_{\theta, b}(x, a) = Q_{\theta, 0}(x, a + b).

The pull is a translation of the aiming point, and the surrogate is equivariant to it for free.

The inputs

A throwing distribution here is a bivariate Gaussian or Student-tt with covariance (or scale matrix) Σ\Sigma and degrees of freedom ν\nu. We can describe it with four numbers u=(log⁡s,e1,e2,τ)u = (\log s, e_1, e_2, \tau):

Input Meaning Range
log⁡s\log s size: s=∣Σ∣1/4s = \lvert\Sigma\rvert^{1/4}, the geometric mean of the two axis spreads 55 to 3636mm
(e1,e2)(e_1, e_2) shape and lean: log⁡(major/minor) (cos⁡2ϕ,sin⁡2ϕ)\log(\text{major}/\text{minor})\,(\cos 2\phi, \sin 2\phi), where ϕ\phi is the angle of the major axis up to 1.8:11.8 : 1, any lean
τ=1/ν\tau = 1/\nu tail weight; τ=0\tau = 0 is the Gaussian 00 to 0.440.44 (ν≥2.27\nu \geq 2.27)

These are chosen so that the function being learned is as smooth as possible in them:

  • Size enters as a logarithm, so that a 10%10\% change in spread is the same step whether Alice is a 66mm or a 3030mm thrower.
  • Shape uses the doubled angle. In polar coordinates (ratio, angle), the angle is undefined for a round group and wraps around every 180°180°. The doubled-angle coordinates have neither problem: the shapes fill a disc, with round at its centre.
  • Tail weight enters as 1/ν1/\nu, so the Gaussian is an ordinary point at τ=0\tau = 0, rather than the limit ν→∞\nu \to \infty.

In fact, (e1,e2)(e_1, e_2) are exactly the free entries of the matrix logarithm of the throw:

log⁡Σ=2log⁡s I+(e1e2e2−e1),\log \Sigma = 2 \log s\, I + \begin{pmatrix} e_1 & e_2 \\ e_2 & -e_1 \end{pmatrix},

so the three inputs (log⁡s,e1,e2)(\log s, e_1, e_2) are the log-Euclidean coordinates of the covariance matrix.

The design

The training throws are a scrambled Sobol sequence over this region: 256256 throws, with the shape coordinates mapped so that they are uniform over the disc, and every eighth throw placed exactly at τ=0\tau = 0, so that the Gaussian edge is pinned down. Each was solved exactly. A further 4848 throws, drawn independently, were solved as a held-out test set. Every input is scaled to [0,1][0, 1] before regression.

Compress

Stack the 256256 value vectors into a matrix Y∈R256×15902Y \in \mathbb{R}^{256 \times 15902}, subtract the mean vector yˉ\bar y, and take its singular value decomposition, Y−1yˉ⊤=ASW⊤Y - \mathbf{1}\bar y^\top = A S W^\top. The rows of W⊤W^\top are the principal components wkw_k, and each throw’s coordinates on them are its component scores zkz_k.

Compression
Left: the share of the variation between throws that the first kk components leave out. Right: the resulting rms error over all 15,90215{,}902 values of every design throw.

How compressible are the value tables? The first component alone carries 99.74%99.74\% of the variation between throws. Ten components reconstruct the values of the design throws with an rms error of 0.0130.013 visits, and forty with 0.00370.0037 visits. The surrogate keeps forty, so the problem becomes learning 4040 smooth scalar functions of four inputs, instead of 15,90215{,}902.

What the components mean

Before regressing anything, it is worth asking what these components actually represent. Correlating each throw’s component scores with its inputs gives a clear picture of the first four:

Component Share of variance Correlation with log⁡s\log s with e1e_1 with e2e_2 with τ\tau
PC1 99.74%99.74\% −0.92-0.92 0.010.01 0.000.00 0.230.23
PC2 0.22%0.22\% −0.38-0.38 −0.03-0.03 0.010.01 −0.10-0.10
PC3 0.017%0.017\% −0.01-0.01 0.950.95 0.220.22 −0.03-0.03
PC4 0.013%0.013\% 0.000.00 −0.24-0.24 0.950.95 0.060.06

(The signs of the components are arbitrary, so in the figures each one is flipped so that its score increases with the input that drives it.)

Size, and an arch

The first component, PC1, represents the size of the throwing distribution. Its loadings have the same sign on every value, and grow with the score: making a player worse costs visits from everywhere, and more from further away. Its score is a smooth but strongly curved function of log⁡s\log s (a straight line explains 84%84\% of its variation, a cubic 99%99\%). Tail weight mostly enters here too: at the same scale, a heavier tail is simply a worse player.

PC2 also represents size, but it is not a new factor. Its loadings have opposite signs on long scores and on checkouts, so it moves visits between the scoring and finishing phases of the leg. But its score is almost a function of PC1’s: for the Gaussian throws, a quadratic in the PC1 score explains 95%95\% of it.

The first two components
Left: the loadings of PC1 and PC2 on the visits to finish from the start of a visit, for every score. The dotted line is 170170. Right: each design throw’s PC2 score against its PC1 score, coloured by size.

This is the arch (or horseshoe) effect, familiar from ecology and multidimensional scaling. As a throw gets bigger, its value vector traces a smooth curve through R15902\mathbb{R}^{15902}. PCA can only describe that curve with straight lines: the first component follows its overall direction, the second its curvature, and so on. PC5 is the next term: for Gaussian throws it, too, is a function of the PC1 score (R2=0.87R^2 = 0.87 for a quadratic), but across all throws it isn’t (R2=0.03R^2 = 0.03), so it also carries how the tail bends the curve.

So the effective dimension of the solutions is small, close to the number of inputs, but the solutions lie on a curved surface, not a flat one. A linear method needs several components to follow it, and that is part of why forty components are needed for 0.0040.004 visits of accuracy, even though the first carries almost everything. Whether the curve can be straightened is the subject of a later section.

Shape, and the double ring

PC3 represents the shape of the group (tall versus wide), and PC4 its lean. Their scores correlate at 0.950.95 with e1e_1 and e2e_2 respectively, and their loadings are almost zero above about 100100: the shape of a group barely matters when scoring, and matters a lot when finishing. Where they matter most is the doubles, and the board suggests what to look for there.

The double ring is thin radially and long around the board, so an elongated group should do well at the doubles where its long axis runs along the ring, and badly where it runs across it. If this is what the components capture, each double’s loading should follow the second angular harmonic of its position on the board, which is also the harmonic that the shape coordinates use. Taking ϑ\vartheta as each double’s angle from the top of the board:

  • PC3’s loadings on the twenty doubles correlate at −0.78-0.78 with cos⁡2ϑ\cos 2\vartheta;
  • PC4’s correlate at +0.76+0.76 with sin⁡2ϑ\sin 2\vartheta;
  • the two harmonics together explain about two thirds of the variation across the doubles. Most of the rest comes from the fallbacks that each finish has: missing double 2020 inside the board leaves double 1010, and no harmonic of position can capture that.
Shape on the board
The change in visits to finish from each double when a 1212mm group is made 1.65:11.65 : 1, as the surrogate predicts it. The grey ellipse at the centre is the group. Left: wide. Right: leaning.

Making a 1212mm group 1.65:11.65 : 1 wide makes the doubles at the top and bottom of the board cheaper (double 33 by 0.230.23 visits, double 11 by 0.220.22), and the doubles at the sides dearer (double 1313 by 0.160.16, double 1111 by 0.150.15). Leaning the same group rotates the pattern by 45°45°. As a check, the same change computed from two exact solves agrees with the surrogate’s at r=0.999r = 0.999 across the twenty doubles, with the largest difference 0.0110.011 visits.

It is worth emphasising that the model was never told about the double ring, or where it is: it found the board’s second harmonic from 256256 solutions alone.

Shape and size also interact. The length scales below hint at this, and a direct check confirms it: the PC3 score of a 1.8:11.8 : 1 group is largest for 1212 to 1818mm players, but the total effect of that shape on the values grows with size, from 0.100.10 visits rms at 55mm to 0.330.33 at 3636mm. For weak players, much of the effect of shape is simply to make them effectively bigger, and so it moves into the size components.

Regress

Each of the forty component scores is now a scalar function of the four inputs, zk(u)z_k(u), known at the 256256 design throws. Each gets its own Gaussian process:

zk(u)∼GP(mk, σk2 ρ(rk(u,u′))+ηk2 δuu′),rk(u,u′)2=∑d=14(ud−ud′)2ℓkd2,z_k(u) \sim \mathcal{GP}\big(m_k,\ \sigma_k^2\, \rho(r_k(u, u')) + \eta_k^2\, \delta_{uu'}\big), \qquad r_k(u, u')^2 = \sum_{d=1}^{4} \frac{(u_d - u'_d)^2}{\ell_{kd}^2},

with the Matérn-5/25/2 correlation

ρ(r)=(1+5 r+53r2)e−5 r.\rho(r) = \left(1 + \sqrt{5}\, r + \tfrac{5}{3} r^2\right) e^{-\sqrt{5}\, r}.

A few notes on these choices:

  • Matérn-5/25/2 gives functions that are twice differentiable, rather than the infinitely smooth functions of the squared-exponential kernel, which is often too smooth for real simulators. The value function does have kinks in principle (each value is a minimum over aims, so its derivative jumps where the best aim changes), but they are small once spread across thousands of states.
  • One length scale per input (automatic relevance determination) allows each component to vary at its own rate in each direction, and makes the fitted model interpretable.
  • The nugget ηk2\eta_k^2 is a small white-noise term. The solves are deterministic, so it is not modelling noise; it absorbs the numerical error of the solver and keeps the covariance matrix well conditioned.
  • Hyperparameters (σk,ℓk⋅,ηk)(\sigma_k, \ell_{k\cdot}, \eta_k) are fitted by maximising the log marginal likelihood (below), with the targets standardised first and the optimiser restarted twice from random initial values. Fitting all forty processes takes about a minute (scikit-learn).
  • The processes are independent. The component scores are uncorrelated over the design, by construction, but they are not independent functions (PC2 is nearly a function of PC1). Modelling them jointly would need a multi-output kernel. As we’ll see, the calibration suggests the independent model is good enough.

The log marginal likelihood maximised for each process, with KkK_k the covariance matrix of the n=256n = 256 design throws, is

log⁡p(zk∣U)=−12zk⊤Kk−1zk−12log⁡∣Kk∣−n2log⁡2π.\log p(z_k \mid U) = -\tfrac{1}{2} z_k^\top K_k^{-1} z_k - \tfrac{1}{2} \log \lvert K_k \rvert - \tfrac{n}{2} \log 2\pi.

A prediction for a new throw uu uses each process’s posterior mean,

z^k(u)=mk+kk(u)⊤Kk−1(zk−mk1),y^(u)=yˉ+∑k=140z^k(u) wk,\hat z_k(u) = m_k + k_k(u)^\top K_k^{-1} (z_k - m_k \mathbf{1}), \qquad \hat y(u) = \bar y + \sum_{k=1}^{40} \hat z_k(u)\, w_k,

where kk(u)k_k(u) is the vector of covariances between uu and the design throws. That is 4040 kernel evaluations against 256256 design throws and one multiplication by a 40×15,90240 \times 15{,}902 matrix: about 1515ms for one throw, or about 33ms each in a batch of 4848.

What the processes learned

The fitted length scales are in units of each input’s full range, so a length scale above 11 means “smooth across the whole region”:

Component size e1e_1 e2e_2 tail
PC1 7.4 36 37 60
PC2 1.5 6.3 5.4 10
PC3 1.35 2.2 2.0 6.8
PC4 1.1 1.7 1.3 6.5
PC5 to PC10 0.6 to 1.1 1.0 to 3.5 0.9 to 2.7 4.0 to 7.3

This matches the interpretation above. PC1 depends on size, smoothly, and effectively on nothing else. PC3 and PC4 depend on their shape coordinate, but also have short length scales in size: that is the interaction. Tail weight is the smoothest input for every component. Later components vary faster in every direction, which is what you’d expect of the higher-order terms of a curved surface.

What the GPs learned
The posterior mean of the first four processes along one input at a time, with the other inputs held at a round, Gaussian throw (PC1 also for a heavy tail, and PC3 and PC4 at four sizes). The posterior bands (±2\pm 2 sd) are drawn, but are too narrow to see at this scale.

Does it know what it doesn’t know?

An emulator’s uncertainty matters as much as its mean: it shows where to run the simulator next, and how far a prediction can be trusted. The processes give a predictive variance sk2(u)s_k^2(u) for each score. If the components were the whole story, the variance of each predicted value ii would be ∑ksk2(u) wki2\sum_k s_k^2(u)\, w_{ki}^2.

But they are not the whole story: forty components cannot represent everything, and the processes’ variance does not account for what is left out. So the surrogate adds, for each value, the variance that the forty kept components leave unexplained across the design throws:

Var⁡[y^i(u)]=∑k=140sk2(u) wki2+ti2,ti2=1n∑j=1n(yji−yˉi−∑k=140zjk wki)2.\operatorname{Var}\big[\hat y_i(u)\big] = \sum_{k=1}^{40} s_k^2(u)\, w_{ki}^2 + t_i^2, \qquad t_i^2 = \frac{1}{n} \sum_{j=1}^{n} \Big(y_{ji} - \bar y_i - \sum_{k=1}^{40} z_{jk}\, w_{ki}\Big)^2.
Calibration
The share of held-out values whose error is within kk predicted standard deviations. A calibrated Gaussian model follows the dashed line.

On the 4848 held-out throws, the processes’ variance alone is overconfident: 85%85\% of errors are within two standard deviations, against 95%95\% for a calibrated model, and 55%55\% within one, against 68%68\%. With the truncation term added, these become 95.3%95.3\% and 70%70\%, and the median standardised error is 0.650.65, against an ideal of 0.670.67. The truncation term is estimated in-sample, which could have made it optimistic; with 256256 design throws, it isn’t. With fewer, it is: at 128128 throws, only 9090 to 92%92\% of held-out errors fall within two standard deviations, and that estimating the truncation by 5-fold cross-validation restores 9494 to 97%97\%.

Judge it by its decisions

The obvious way to measure a surrogate is the error in its outputs. On the held-out throws, the predicted values are within 0.0050.005 visits on average, and 0.120.12 at the single worst of 763,296763{,}296 values. However, Alice does not play darts with the values directly; what matters is whether the aims chosen using them are as good as the aims chosen using exact values.

Instead, for each held-out throw, we can take 2,5002{,}500 situations: every start-of-visit score from 22 to 501501, and 2,0002{,}000 random mid-visit situations at low scores, where the decisions are hardest. In each, the surrogate’s aim is the one minimising QQ with the exact outcome probabilities and the predicted values. Its decision loss is how many visits that aim costs more than the best one, both priced with the exact solution:

ℓ(x)=Q∗(x,a^(x))−V∗(x),\ell(x) = Q^{\ast}\big(x, \hat a(x)\big) - V^{\ast}(x),

where the surrogate’s aim is

a^(x)=arg⁡min⁡a[c(x)+∑oP(o∣a) V^(x′(x,o))].\hat a(x) = \arg\min_a \Big[c(x) + \sum_o P(o \mid a)\, \hat V\big(x'(x, o)\big)\Big].
Accuracy
Mean error in the values against the mean decision loss per aim, on the held-out throws, for the surrogate with different amounts of data and components, and for the crudest alternative: the values of the nearest solved design throw.
Model Value error, mean Decision loss per aim, mean Worst throw Worst single aim
nearest solved throw 0.741 0.00116 0.00514 0.152
64 throws, 40 components 0.017 0.00022 0.00222 0.049
128 throws, 40 components 0.009 0.00012 0.00111 0.031
256 throws, 20 components 0.007 0.00020 0.00122 0.037
256 throws, 40 components 0.005 0.00010 0.00066 0.024

There are several interesting observations:

  • The decisions are much better than the values. An aim is only affected by the differences between the values of the states that it can lead to, so any error shared by those states costs nothing. A decision loss of 0.00010.0001 visits per aim means a few thousandths of a visit over a whole leg.
  • Value error does not predict decision quality. With 2020 components, the values are more accurate than with 128128 throws and 4040 components (0.0070.007 against 0.0090.009 visits), but the decisions are almost twice as bad (0.000200.00020 against 0.000120.00012 visits per aim). Whatever the last twenty components carry, it matters more for decisions than their tiny share of the variance suggests.
  • Regression beats lookup by a factor of ten. Using the nearest solved throw gets the values wrong by three quarters of a visit on average, and costs ten times as much in decisions. In four dimensions, 256256 throws are far apart.
  • More data helps steadily. 6464, 128128 and 256256 throws give 0.000220.00022, 0.000120.00012 and 0.000100.00010 visits per aim.
  • The weakest region is the edge of the design. The three worst held-out throws are all tight (55 to 77mm), strongly elongated and Gaussian, where the region ends in two directions at once.

Can we straighten the curve?

The arch suggests an obvious improvement. If the values were transformed so that they changed more linearly with the throw, PCA would need fewer components, and the processes would have simpler functions to learn. Let’s try four transforms of the values before compressing them:

  • log, after counting the visit in progress, so that every value is at least 1.061.06 (the two entries for scores 00 and 11 are always zero, and are left alone);
  • relative: each throw’s values divided by its visits from 501501, so that PCA is given only the shape of the value function;
  • log-relative: both;
  • standardised: each value scaled to unit variance across the design, which changes how PCA weights the values rather than their geometry.

To measure compression alone, the components are learned on the design throws, the held-out throws are projected onto them and transformed back, and the error is measured in visits. The relative transforms were given each held-out throw’s true visits from 501501, so they had a head start.

Straightening
Held-out reconstruction error against the number of components. Left: transforming the values before PCA. Right: separate components for overlapping windows of size.

None of the transforms beats the raw values, at any number of components from 22 upwards. At 4040 components, the held-out error is 0.00480.0048 visits for the raw values, 0.00490.0049 standardised, 0.00590.0059 relative, 0.00660.0066 for the log and 0.00670.0067 for the log-relative values. Power transforms VλV^\lambda (the Box–Cox family, of which the log is the case λ=0\lambda = 0) do no better: λ=12\lambda = \tfrac{1}{2} and λ=2\lambda = 2 both give 0.00540.0054 visits, and λ=−1\lambda = -1 gives 0.01700.0170.

In hindsight, this was guaranteed on the design throws. By the Eckart–Young theorem, PCA of the raw values is the best rank-kk linear approximation in squared error, measured in visits: exactly the error being measured. A transform optimises a different error. The log, for example, spends its components on relative accuracy, which matters most for the small values near the end of a leg. A transform could only win by making the data genuinely lower rank, and none did: the arch survives every one of them, with PC2 still 9595 to 100%100\% explained by a quadratic in PC1.

So the curvature is not a matter of scale. A better player does not simply need proportionally fewer visits from everywhere: the shape of the value function changes, as more of the cost moves into finishing. No transform applied to each value separately can straighten that. (The log does make PC1 more linear in the inputs, with R2R^2 rising from 0.840.84 to 0.960.96, but it compresses worse.)

What about local components? If the curve cannot be straightened, it can at least be followed piecewise, using separate components for overlapping windows of size, with each held-out throw assigned to the window containing its size. With six windows, 2020 components per window reconstruct the values as well as 4040 global ones do (0.00490.0049 against 0.00480.0048 visits). With 4040 per window, the error falls to 0.00350.0035. So the curvature roughly doubles the number of linear components needed.

As a full surrogate, three windows reduce the held-out value error by about 10%10\%, from 0.00730.0073 to 0.00660.0066 visits rms. Each window has about 110110 design throws, and the predictions are blended linearly in log⁡s\log s between the windows’ centres, so that they do not jump at the boundaries. Its uncertainty becomes slightly conservative (97.7%97.7\% of errors within two standard deviations, against the global surrogate’s 95.3%95.3\%), because the blend adds the windows’ disagreement to the variance. The gain is small because each window’s processes are fitted to fewer throws, so the regression error grows and takes back most of what the compression gained.

A polynomial trend

A different kind of polynomial does straighten the curve. Instead of transforming the values, fit them by least squares on polynomial features of the inputs, and do PCA on what is left. PC2 was almost a quadratic in PC1, and PC1 is a smooth curve in size, so a polynomial in the inputs should absorb much of the arch exactly, with no truncation at all. The Gaussian processes then model the components of the remainder. This is a vector-valued form of what the kriging literature calls universal kriging: a regression trend, plus a Gaussian process for the residual.

Trend removed before PCA Held-out error: 5 components 20 components 40 components Full surrogate, 40 components Within 2 sd
none 0.0251 0.0088 0.0048 0.0073 0.953
cubic in size (44 terms) 0.0217 0.0082 0.0048
cubic in size, linear in the rest (88 terms) 0.0170 0.0075 0.0046 0.0070 0.943
full cubic in all four inputs (3535 terms) 0.0098 0.0057 0.0041 0.0091 0.924

Rms errors in visits on the held-out throws: reconstruction after removing the trend, and the full surrogate (trend plus Gaussian processes).

For compression alone, this works well. With a full cubic trend removed, 55 components reconstruct the held-out throws 2.52.5 times more accurately than before, and 4040 components 15%15\% more accurately (0.00410.0041 visits): not quite what local PCA achieved (0.00350.0035), but without splitting the data.

As a full surrogate, however, it does not help. The small trend gains 4%4\%, and the full cubic makes things 25%25\% worse. The reconstruction test projected each held-out throw’s true remainder onto the components, which absorbs the trend’s own errors without revealing them; in the surrogate, the Gaussian processes have to predict that remainder, and two things go wrong:

  • A 3535-term polynomial fitted to 256256 throws oscillates, particularly towards the edges of the region: on its own, it is out by 0.0930.093 visits rms on the held-out throws. Subtracting it from the smooth value function leaves a remainder that is rougher, and harder to learn, than the original.
  • The trend’s uncertainty is not modelled. Its coefficients are treated as known, so the surrogate becomes overconfident: 92%92\% of errors within two standard deviations, rather than 95%95\%.

The underlying reason is that the Gaussian processes were already modelling the curve, non-linearly, in the inputs. A parametric trend only helps if it is simple enough to be right everywhere, and the one that is right everywhere is too simple to remove much curvature. (Gaussian processes with explicit basis functions would put a prior on the trend’s coefficients and carry their uncertainty into the predictions, which should fix the calibration, but I wouldn’t expect more than a few percent in accuracy.)

Where the error actually is

The truncation error lies outside the span of the 4040 components, and the regression error inside it, so the two are orthogonal and their squared errors add exactly. That makes it easy to see where the global surrogate’s held-out error comes from:

Where the error is
The share of the held-out squared error due to truncation (what the 4040 components can’t represent), and to each group of components’ regression error.

Truncation is 44%44\% of the error, and regression 56%56\%. Most of the regression error is in the two size components: PC1 accounts for 44%44\% of it and PC2 for 20%20\%. PC1’s score is predicted to within 0.1%0.1\% of its spread, but it carries so much of the variance that even 0.1%0.1\% dominates.

So is the regression missing a better feature? The obvious candidates for the size components are size in millimetres rather than its logarithm (the visits from 501501 grow roughly linearly in σ\sigma), and an explicit linear trend in the kernel. In millimetres, their regression error falls from 0.00440.0044 to 0.00410.0041 visits; the trend adds nothing. The processes are already flexible enough in the size direction. The limiting factor is data: with 6464, 128128 and 256256 design throws, the mean value error roughly halved with each doubling (0.0170.017, 0.0090.009 and 0.0050.005 visits).

So what can we conclude? The curvature is real and intrinsic, and it costs about a factor of two in components, which at 4040 components is cheap. The single most effective improvement would be more exact solves, placed where the surrogate is least certain. And none of it would change much at the level of decisions: at 0.00010.0001 visits per aim, there is very little left to gain.

What it was for

The surrogate made it possible to put a belief over the whole throw (size, shape, lean, tail and pull) and act on it during a game: each decision combined exact outcome probabilities at a few representative throws from the belief with the surrogate’s values. As described in the last post, the answer was mostly negative: from scores alone, shape and pull are learned too slowly to be worth the uncertainty about them. That’s a finding about darts, not about the surrogate, which did its job: in that experiment, a belief using its values made almost exactly the same decisions as one using exact solves on a grid.

What’s next

What have we learned about the surrogate?

  • The solved game is extremely compressible: the first principal component carries 99.74%99.74\% of the variation between throwing distributions, and 4040 components reconstruct the values with an rms error of 0.0040.004 visits.
  • The components have clear meanings: size, the curvature of the size direction, and two shape components that follow the double ring’s second harmonic.
  • Judged by its decisions, the surrogate is very accurate, losing 0.00010.0001 visits per aim, and its uncertainty is calibrated once the truncation error is included.
  • Its remaining error is split between truncation and regression, and more exact solves, rather than cleverer transforms of the values, are the best way to reduce it.

The section above suggests that more data would help most, and the original design was fixed in advance. But the surrogate’s own uncertainty shows where new solves would be most useful (the tight, elongated edge of the region), so it can be used to choose them. Growing the design in batches, each chosen to reduce the surrogate’s integrated variance, needs about half as many solves for the same value accuracy, and ends 14%14\% better at 256256 throws (0.00630.0063 against 0.00730.0073 visits rms). But the decision loss stays at 0.00010.0001 visits per aim whichever way the solves are chosen, and choosing them more carefully doesn’t change that.

There are also two directions I haven’t tried yet:

  • A non-linear compression. Local PCA shows the curvature costs about a factor of two in linear components. A genuinely non-linear method, such as a Gaussian process latent variable model or an autoencoder, could follow the curve with fewer dimensions, but it would lose PCA’s simple, exact way of carrying the uncertainty through to the values.
  • Running it in the browser. The fitted model is just arrays: the mean, forty components, and for each process its design points, weights and hyperparameters. That is about 2.62.6MB, and a prediction is fast enough for an interactive figure: drag the size, shape and tail of a throw and watch the value of every finish change.

The code is in the DartsStrats repository: the surrogate in darts/surrogate.py, the exact solves in results/surrogate/, its evaluation in notebooks/experiments/28-a-surrogate-for-the-solved-game.ipynb, choosing the solves in notebooks/experiments/30-choosing-the-solves.ipynb, and the figures for this post in notebooks/Posts/2026-12-surrogate.ipynb.