Projects  /  Decision Mesh  /  The gate

A mesh that knows when to stop

The odds of a coin vary over this square. A few thousand sites each flip a coin a handful of times. The estimator refines a mesh of right triangles or rectangles only where a false-discovery gate finds support in the flips, and stops when no candidate passes.

Ready
The odds what the coins really do
The flips each site's share of heads
The fit dots: admitted, by round

The gate, round by round

Each round scores every candidate vertex (the midpoints of the mesh's edges) by how much it would improve the fit. If no candidate mattered, the scores would look like draws from one bell curve, the null. The gate fits the density of all the scores, reads the null's centre and spread off the middle of it, estimates the share π0 that are noise, and admits the candidates that stand out from that null at a controlled false-discovery rate. When the scores have no central peak to read a null from, it falls back to the textbook one. Each coin also has an effect of its own on the log-odds, and the coin variance is the estimator's estimate of their spread, fitted alongside the surface: as the mesh learns the odds, what it can't explain shrinks toward the spread the slider set. How the gate decides draws each of these steps from a live run.

Try giving the two hills more flips and watch the mesh fill in around them; pick “nothing at all”, which it leaves uncut at any number of flips; pick “your drawing” and paint on the odds (drag to raise them, tick “lower” or hold shift to lower them).

The estimators are triangular-decision-mesh and rectangular-decision-mesh, compiled from their C++ with Emscripten. Their dense linear algebra, which natively calls LAPACK, runs on Eigen here, and the builds can write a trace of each round's candidates for the illustrated page; nothing else is changed, and on my test designs the browser builds reproduce the native meshes to 1e-11. The two share the gate and the model for the coin effects and differ in geometry: right triangles cut only through their hypotenuse, with a flat fit in each; rectangles cut across either axis, with a bilinear fit in each. Half the sites are held out: the mesh never sees them, and the deviance card scores the fit on them. The coins are drawn on this page from the odds you pick, plus a normal effect per coin on the log-odds, with the standard deviation on the slider (0.25 to start). Set it to zero and the coins are plain binomial.

The growing-mesh page grows the same geometries by a simple greedy rule with no gate: freeform triangles, right triangles, rectangles and a tree, grown greedily side by side. The right triangles there are this estimator's geometry.

Cite it
@software{triangular_decision_mesh,
  author = {Babichenko, Samuel},
  title  = {triangular-decision-mesh: an adaptive right-triangle mesh regression with a false-discovery gate},
  year   = {2026},
  url    = {https://github.com/sbabichenko/triangular-decision-mesh}
}

@software{rectangular_decision_mesh,
  author = {Babichenko, Samuel},
  title  = {rectangular-decision-mesh: an adaptive rectangular mesh regression with a false-discovery gate},
  year   = {2026},
  url    = {https://github.com/sbabichenko/rectangular-decision-mesh}
}