nx_multivariate.nx
buildroot/runtime/nx_multivariate.nx
about
nx_multivariate.nx -- multi-axis Monte Carlo verifier with
Bonferroni family-wise correction.
User: "inputs from classifiers lead to known outputs all with
statistical measurement i mean monte carlo or other multivariate
systems prove this".
Closes the multivariate half of the predictability cardinal.
Single-axis MC verification (nx_monte_carlo.nx) handles ONE
measurable property at a time. Real generation needs to verify
MANY properties simultaneously: age AND gender AND ethnicity AND
pose AND lighting AND style all within their target distributions.
===== Statistical method =========================================
Two ways to extend single-axis t-test to multivariate:
(a) Hotelling T-squared (Hotelling 1931): joint test with full
covariance matrix. Optimal power; requires N x N matrix
inverse for N axes.
(b) Per-axis t-tests + Bonferroni correction (Bonferroni 1936
/ Dunn 1961): independent test per axis; correct family-
wise alpha by dividing by N_axes. Conservative but no
matrix inverse; works for arbitrary axis count.
We ship (b) for v1. Hotelling T² queued (nx_matrix has det /
inv for 2x2 + 3x3; arbitrary N needs LU-decomp primitive).
Bonferroni: to maintain family-wise alpha = 0.05 across N axes,
each per-axis test uses alpha_individual = 0.05 / N. Critical
t-value increases accordingly. Conservative because it assumes
worst-case correlation; actual independence makes it overpowered,
but the worst case is what statistical guarantees need.
Decision rule:
For each axis i:
verify with nx_monte_carlo using corrected critical t.
If ANY axis returns OFF_TARGET: overall OFF_TARGET.
If ALL axes return TARGET_MET: overall TARGET_MET.
dependencies 4 imports · 1 importers
imports: nx_syscalls.nxnx_tier.nxnx_loop.nxnx_monte_carlo.nx
imported by: nx_patch_attribution.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 119 | struct NxMultivariateResult |
consts
| 61 | const NX_MV_Q10: nx_int = 1024 |
| 98 | const NX_MV_TARGET_MET: nx_int = 0 |
| 99 | const NX_MV_OFF_TARGET: nx_int = 1 |
| 100 | const NX_MV_INSUFFICIENT: nx_int = 2 |
| 101 | const NX_MV_ERR_BAD_PARAMS: nx_int = 3 |
| 102 | const NX_MV_N_VERDICTS: nx_int = 4 |
| 129 | const NX_MV_RESULT_BYTES: nx_int = 56 |
functions
| 79 | func _mv_bonferroni_critical_t_q10(n_axes: nx_int) -> nx_int |
| 104 | func nx_mv_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 149 | func nx_multivariate_verify( |
| 267 | func _mv_test_sampler(prng: *i64, out_vec: *i64, n_axes: nx_int) -> i64 calls 1: nx_prng_range |
| 277 | func main() -> i64 |