Technical reference

All model documents · source: docs/models/experiments.md

Designed experiments

Module: dexvantage/core/experiments.py (the designs, the runs, the estimators, design.json, the batch run). Study: dexvantage/core/studies/experiments.py (study id experiments; batch flag --experiment-saved OUT.json for the experiment saved in the project; --experiment DESIGN.json [--experiment-out OUT.json] runs a design file). Page: dexvantage/ui/pages/experiments.py (Analysis ▸ Designed experiments). Checks: dexvantage/validation/checks_experiments.py (model experiments). Tests: tests/test_experiments.py. Spec §7.11. Ported from Vantage core/experiments.py: the designs, the bootstrap of the Sobol indices, the main effects and the result layout. The automotive factors (cameras on a vehicle body, load cases, weather, the ROI) are replaced by DexVantage's factor paths (core/factors.py). The responses are the named metrics of core/metrics.py.

What is computed

An experiment evaluates the rig at many settings of a few of its quantities (the factors). It reads one or more figures at each setting (the responses). It reports:

Factors are core/factors paths, in three kinds:

Kind design.json Values
continuous "lo", "hi"; optional "n_levels" (full factorial), "integer": true lo + u·(hi − lo) (rounded when integer)
categorical "levels": [...] (any JSON values, in order) level ⌊u·L⌋ of L
bool "kind": "bool" (or the path's own kind, e.g. .enabled) false, true

u ∈ [0, 1] is the run's unit coordinate. The kind comes from "kind", else from "levels", else from core.factors.describe. Typical paths are:

Use the relative paths to explore around a placement. An absolute pitch range of ±5° turns a camera that looks 60° down to the horizontal. Locked sensors are not varied: a design with one is refused, with the sentence core.factors gives.

Responses are metric ids of core/metrics.py (core/metric_defs.py defines those of the studies, such as coverage.covered or grasp.contact_visibility). Each run sets the factors on a copy of the project (core.factors.apply, a new project; the project itself is never changed). It then reads the responses with core.metrics.evaluate, which runs each study once per run through core.jobs.run_study and the study ResultCache. A study that refuses gives the run no value for its responses. The run records the status (refused, not stated, error) and the study's sentence. The analyses leave that run out of that response and count it. The rig as it is (the baseline) is evaluated first.

Designs

Method Runs How
full_factorial Π Lᵢ every combination of the levels. A continuous factor takes n_levels evenly spaced levels (the design's levels, default 2); the first factor varies fastest
fractional 2^m a two-level fraction at resolution III or IV (below)
lhs n Latin hypercube (McKay, Beckman and Conover 1979). Column j is (πⱼ(i) + Uᵢⱼ)/n, with a random permutation πⱼ and U ~ U(0, 1), seeded
sobol n the first n points of a scrambled Sobol sequence (scipy.stats.qmc.Sobol, Owen scrambling, seeded). Its balance holds for n a power of two; another n is allowed and said
saltelli N(k + 2) the A, B and AB_i matrices of Saltelli (2002). A and B are the two halves of a 2k-dimensional scrambled Sobol sequence of N points; AB_i is A with column i taken from B

Fractional factorials (Box, Hunter and Hunter 2005). Every factor must have two levels: a continuous factor's lo and hi, a bool, or a categorical with two levels. A factor with more levels is refused. The m base factors form a full 2^m factorial in standard order. Each added factor is the elementwise product of some base columns (its generator, e.g. E=ABC):

When m = k there is no fraction to take, and the design is the full 2^k factorial (said). resolution_of finds the resolution reached again by brute force: the length of the shortest set of columns whose product is constant. The result reports it with the generators.

Analysis

Main effects. For each factor, the mean response at each level, with a t interval and its count. The effect is the mean at the factor's last level minus the mean at its first. For a two-level design this is the classical main effect; for a continuous factor it runs from lo to hi. Its interval is Welch's t interval:

d = ȳ_last − ȳ_first,   se² = s²_last/n_last + s²_first/n_first,
ν = se⁴ / ((s²_last/n_last)²/(n_last − 1) + (s²_first/n_first)²/(n_first − 1)),   d ± t_{ν, 1−α/2} · se

It treats the other factors' variation as noise. The sampled designs (the Latin hypercube, the Sobol sequence, and the A and B rows of a Saltelli design) are handled differently. There, a continuous factor's values are cut into quantile bins: bins, six by default, with at most one bin per two runs. The effect is then the last bin's mean minus the first's. Categorical and bool factors always use their levels.

Sobol indices (Sobol 1993). These come from a Saltelli design. They use Jansen's (1999) estimators as Saltelli et al. (2010, Table 2, (f)) give them, with f(·) the response at each row:

V    = Var(f(A) ∪ f(B))            (the 2N values together, ddof 1)
S_i  = (V − ½ · mean_j (f(B)_j − f(AB_i)_j)²) / V          first order
S_Ti = ½ · mean_j (f(A)_j − f(AB_i)_j)² / V                 total

The intervals are percentile bootstrap intervals (Efron and Tibshirani 1993): the N rows are resampled with replacement (bootstrap, 500 by default; 95 % by default). Rows with a missing value anywhere are left out, and dropped counts them. A response that does not vary gets no index, and the result says so.

The best run. This is the run with the best value of the objective response (objective, default the first response) in its metric's better direction. It is compared with the baseline. The headline's status word is:

design.json (schema dexvantage.experiment/1)

{
  "schema": "dexvantage.experiment/1",
  "name": "Overhead and wrist camera tilt",
  "variant": "",
  "factors": [
    {"path": "sensor:Overhead D435.dpitch", "lo": -5, "hi": 5},
    {"path": "sensor:Overhead D435.dz", "lo": -0.05, "hi": 0.05},
    {"path": "sensor:Wrist D405.model", "levels": ["intel-realsense-d405", "intel-realsense-d435"]},
    {"path": "sensor:Overhead D435.enabled", "kind": "bool"},
    {"path": "setting:grasp_visibility.n_grasps", "lo": 100, "hi": 400, "integer": true}
  ],
  "responses": ["coverage.covered", "depth.valid"],
  "objective": "coverage.covered",
  "design": {"method": "lhs", "n": 32, "levels": 2, "resolution": "IV", "seed": 0},
  "analysis": {"bootstrap": 500, "confidence": 0.95, "bins": 6},
  "execution": {"workers": 0}
}
Key Default Meaning
schema — dexvantage.experiment/1; another value is refused
name "" a name for the experiment
variant "" (active) the uid of the variant the runs change and evaluate
factors — up to 32, each {"path", "kind"?, "lo"/"hi" or "levels", "n_levels"?, "integer"?, "name"?}; a path at most once
responses — metric ids, in order (or {"metric": id})
objective first response the response that picks the best run
design.method lhs full_factorial, fractional, lhs, sobol, saltelli
design.n 32 points (lhs, sobol); base samples N (saltelli); 2–100 000
design.levels 2 full factorial: levels of a continuous factor without n_levels (2–11)
design.resolution IV fractional: III or IV
design.seed 0 the sampled designs and the bootstrap
analysis.bootstrap 500 bootstrap resamples (0–5000)
analysis.confidence 0.95 interval level (0.5–0.999)
analysis.bins 6 quantile bins of the sampled designs' main effects (2–12)
execution.workers 0 0 or 1: serial (the default); n > 1: a pool of n processes

These are DexVantage defaults, not standards. A flat layout ("method": "lhs" at the top level) is read too. Numbers out of range are clamped. A missing setting takes its default. The same document is what the page saves in project.analysis.studies["experiments"].

The result (dexvantage.experiments/1) holds:

--experiment also writes the runs as CSV beside the JSON (same name, .csv). It has columns run, block, one per factor path, one per response (with its unit), and one status per response. The JSON records the CSV's name and SHA-256 under files.

--reproduce RESULT.json re-runs the experiments study, which reads the experiment saved in the project. So a result of --experiment-saved (or of the page) reproduces. A result of --experiment DESIGN.json from a project without that design saved is refused with a sentence ("The experiment has no factor yet …"). Run the design again instead: the result carries it under design.

Execution

Runs are serial by default. With workers > 1 they are evaluated in a concurrent.futures.ProcessPoolExecutor of that many spawned processes. Each process:

  1. receives the project once;
  2. imports the modules that register the responses' metrics and studies;
  3. keeps its own ResultCache.

The results are identical to a serial run (tested); only the order of evaluation differs. A cancel (the page's Cancel run, or the study's cancel) stops between runs; pooled runs already queued, at most two per process, finish first. A run during which the cancel came is discarded, because a study stopped part-way gives no value to keep. The runs done are analysed.

Two caches serve the runs:

Runs are evaluated on a copy of the project without the experiment's own settings. So Run after a cancel, or after an edit to the design that keeps some of its runs, evaluates only the runs not done (tested). A process pool does not use the run cache.

Timings were measured on the development machine (2026-11-07):

Validation

dexvantage --validate out/ --models experiments (measured 2026-11-07, seed 20261027):

Check Reference Tolerance (why) Measured
experiments.sobol_ishigami the Ishigami function's analytic indices (a = 7, b = 0.1), derived again in the check: V1 = ½(1 + bπ⁴/5)², V2 = a²/8, V13 = ½b²(π⁸/9 − π⁸/25) 2/√N: 0.031 at N = 4096, 0.0625 at the quick run's 1024. About 0.6 of the bootstrap 95 % half-width at those N (0.045–0.053; 0.088–0.095). Every analytic index must also lie in its interval 0.0008 (N = 4096), 0.012 (N = 1024); all inside
experiments.lhs_strata the Latin hypercube's definition: one point per stratum 0 (counts are exact) 0 (n = 7, 50, 256; five factors, on the factor values)
experiments.sobol_discrepancy scipy.stats.qmc.discrepancy (CD) on the Sobol design and the Latin hypercube; scipy.stats.qmc.Sobol points with the same seed 1e-9 relative (floating point) 3.4e-11
experiments.sobol_vs_random E[CD²] of n independent uniform points, ((5/4)^d − (13/12)^d)/n, itself checked against 40 random sets (within 15 %) 0.5 ratio (a low-discrepancy set sits far below random; a loose bound) 0.027 (n = 256, d = 4); the 40-set mean is 3.6 % from the expectation
experiments.main_effects_linear the coefficients × ranges of y = 2 + 3a − 1.5b + 0.5c + 4[d = B] (3 × 3 × 3 × 2 factorial), and a linear model plus 2·x1·x2 − x3·x5 on a resolution IV fraction (7 factors, 16 runs) 1e-9 (exact) 0
experiments.fractional_resolution the definition of resolution, by brute force; the smallest run count; SᵀS = nI 0 designs failing 0 of 20 (3–12 factors, III and IV)

The tests add the following:

Self-test line experiments: Ishigami at N = 1024 within 2/√N, and a 16-run resolution IV fraction's exact main effects: 31 ms in a full self-test, about 0.4 s alone (importing scipy.stats).

Known limits

References