Commit 8316e60
committed
Three-class Material Source strength GP
The BOxCrete dataset spans three physically distinct material sets, not
two: Set 1 mortars (Amrize 1L / Class C fly ash, no coarse aggregate),
Set 2 concretes (Heidelberg 1L / Class C), and Set 3 concretes (Amrize
1L / Class F). The deployed model previously treated Material Source as
a continuous ARD coordinate, which forces a single lengthscale to span
both the Set 1 <-> Set 2 and the Set 1+2 <-> Set 3 gaps -- ill-defined
when the axis is really an unordered categorical.
Model
- Material Source becomes a 3-level categorical. The source-aware branch
is now ScaleKernel(CategoricalKernel(source) * Matern(rest)), a Bonilla
et al. (2008) intrinsic-coregionalization factorisation: one shared
Matern shape plus a single learned cross-class correlation
rho = exp(-1/ell). Full kernel is blind_matern + source_branch +
additive_rbf_time, wrapped in TimeGatedKernel (gate tau = 0.10) so the
prior variance at t=0 is exactly zero and f(x, 0) = 0 holds
structurally, without day-zero anchor pseudo-observations.
- Training minimises a combined block-LOO + marginal-likelihood
objective (boxcrete/block_loo.py). Blocks are unique compositions, so
the loss measures held-out-composition curve prediction -- what the
explorer and the BO loop actually consume. The MLL term contributes
the -0.5 log|K| complexity penalty that block-LOO structurally lacks,
keeping curves smooth between training ages.
- ComposedLengthscalePrior lets the within-group shrinkage prior
(Cement/FA/Slag tied, Fine/Coarse Aggregate tied) compose with the
per-dim lognormal baseline.
Data and naming
- boxcrete/mix_naming.py decodes the 3 classes to canonical mix names
from composition alone, backed by _mix_naming_table.csv: M1..M69
(69 Set 1 mortars), C1..C27 (27 Set 2 concretes), C28..C80 (53 Set 3
concretes), 149 mixes total.
- data/boxcrete_data.csv carries the Set 3 rows and the 3-class Material
Source encoding. Clay-using mortars M75/76/77 are dropped.
- docs/materials_background.md documents the chemistry behind each class.
Explorer
- docs/ui.mjs exposes Material Source as a 3-way selector; gp.mjs and
gp_v2_fast.mjs implement the categorical branch for JS-Python parity.
- Regenerated docs/model/* artifacts (strength_model.pt, test_vectors,
compositions, mix_analyses) via experiments/regenerate_all_artifacts.sh.
- docs/model/mix_analyses.json is re-authored for the 3-class catalog.
The renumbering left the previous narratives keyed to a catalog order
that no longer exists (only 31 of 144 entries still index-aligned, and
70 changed Material Source label), so they could not be carried over.
Each of the 149 entries now names its canonical mix, states its
verified mix-design figures, and interprets its behaviour against
sibling mixes in the same designed series. The entries deliberately do
not restate measured strength points, embodied carbon, or Pareto
status: the explorer already overlays observations on the strength
curve, gives GWP/cost/W-B their own readouts, and shows Pareto
membership as a pill, so repeating them only padded every entry.
regenerate_all_artifacts.sh no longer invokes
docs/generate_mix_analyses.py, whose templated fallback output would
overwrite the authored prose -- this restores the contract that
script's own docstring already specified.
Explorer performance
- predictStrengthCurveV2 gains a `meanOnly` option that skips the
Cholesky/dtrsm variance solve and the [n x nTimes] K allocation. The
mean is already accumulated during the kernel build, so output is
bit-identical; only discarded work is removed. Routed the two callers
that render no uncertainty band -- the dashed preview curve and the
scatter position marker -- through it. Preview at 48 points: 5.94 ms
-> 2.86 ms (2.1x).
- drawStrengthCurve's `isInteracting` now also covers preview activity.
Previously, while the preview curve animated at 60 fps the main curve
stayed on the 64-point grid because neither a slider nor a composition
animation was in flight, making preview-settling the most expensive
frame in the app. Behaviour at rest is unchanged (showPreview is false,
so the expression evaluates exactly as before and the curve is still
sampled at 64 points).
- The strength curve is now crossfaded between two precomputed endpoint
posteriors for every animated composition change, not just Material
Source toggles. Both endpoints are known when the animation starts, so
they are computed once and each frame is a lerp instead of a GP solve.
This subsumes the old MS-specific blend: `_msCurveTransition` and
`triggerMaterialSourceTransition`'s bespoke snapshot collapse into
`beginCurveTransition`, which also picks up mid-blend when a transition
interrupts another so the curve never snaps.
The categorical pin in animateToComposition stays: the preview curve,
the scatter marker and the GWP/cost readouts all still read
currentComposition every frame, so Material Source must remain an
integer even though the main curve no longer re-predicts.
Tradeoff: intermediate frames are a convex combination of two
posteriors rather than the posterior of the composition the sliders
show. Both endpoints are exact; only the 350 ms between them is a
visual blend.
- Measured per frame, n_train=670, WASM active, desktop arm64:
scatter hover / preview settling 14.08 ms -> 6.91 ms (51% less);
animated transition 7.05 ms -> 2.93 ms (58% less), and total GP work
across a 350 ms transition 148 ms -> 70 ms (53% less) including the
8.2 ms two-endpoint precompute; sustained slider drag is unaffected
(4.13 -> 4.04 ms) because the preview does not run during a drag.
Tests
- test_composed_prior.py, test_mix_naming.py cover the new modules.
- test_kernel_layout.py and test_lengthscale_identifiability.py updated
for the categorical branch.
- Full suite: 270 passing, 100% line coverage on boxcrete/.1 parent 197add7 commit 8316e60
38 files changed
Lines changed: 4232 additions & 2295 deletions
File tree
- boxcrete
- data
- docs
- model
- experiments
- test
- e2e
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
48 | 60 | | |
49 | 61 | | |
50 | 62 | | |
| |||
0 commit comments