trial_dists
¶
A trial's sampled inputs set against the distributions they were drawn from.
The Dojo's distributions panel (routers/mosaic.py) and SensAI's job agent (sensai/dist_report.py) both read a job's saved distributions and a trial's saved draws. What a draw is in the unit its distribution was declared in, its z-score, and the nominal are worked out here, once, so the two cannot disagree.
read_distributions
¶
read_distributions(
workdir: Path,
) -> DistributionDict | None
The distributions a job's trials were drawn from, or None when it saved none. Raises ValueError when the file is there but cannot be read as distributions.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
read_named_values
¶
What a trial drew, as the JSON it was saved as. Empty when it saved none or the file cannot be read (it can hold non-standard JSON, such as Infinity from numpydantic), so a trial's draws are left out rather than failing the whole request.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
split_nominal
¶
Return (nominal, nominal_label) for a distribution's nominal value.
A nominal may be any type (float, str, list...). Numbers and numeric strings are exposed as a float, other strings and sequences as a label (e.g. for categorical nominals like "class_A").
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
has_z_score
¶
Whether dist is one a z-score is given for, which is one with a mu and a sigma.
z_and_percentile
¶
Return (z_score, percentile) for a sampled value against a distribution.
The z-score is given only for a distribution with a mu and a sigma (WITH_MU_AND_SIGMA); every other one has a percentile alone.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
safe_param
¶
Convert values that can't be serialized to standard JSON to a display string.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
extract_sampled_values
¶
Pull every drawn scalar out of a NamedValue's stored_value, flattening any nesting.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
stored_unit
¶
The unit a NamedValue's stored_value is expressed in, or None if none was recorded. Sampling converts a drawn value into the model's base unit and records that unit on the NamedValue, while the distribution keeps the unit it was declared in.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
in_unit
¶
Re-expresses values from from_unit in to_unit. They come back as they were when either unit is unknown, when the units are the same, or when pint cannot convert between them, so an unrecognized unit leaves the number visible instead of hiding the row.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
sampled_values_in_dist_unit
¶
The drawn scalars for dist, in the unit dist was declared in. A distribution's parameters, nominal, and chart are all in its declared unit, so the drawn value has to be too, or the z-score and percentile compare a base-unit number against declared-unit parameters.
Source code in src/mujoco_mojo/utils/layers/dojo/trial_dists.py
extract_sampled_labels
¶
Pull every drawn label out of a NamedValue's stored_value for non-numeric distributions (e.g. categorical).