EvSys

sweep

Sweep - declarative axes over a single RunConfig.

A Sweep is the OOP way to describe what YAML's matrix: block describes: one base_run template + per-axis lists of values, expanded by cartesian product into N concrete RunConfig rows.

This is what an experiment script reaches for instead of writing a per-axis for loop. Sweep + Experiment together let run.py stay declarative:

sweep = Sweep(base_run, {"algorithm.params.lora_rank": [1, 4, 16]}) for run in sweep.expand(): ...

Or, more commonly, from a YAML matrix block already parsed into MatrixSpec - round-trip with Sweep.from_matrix / .to_matrix.

The expansion is the single source of truth for both the YAML matrix: loader and programmatic builds (the legacy _expand_matrix delegates here).

attribute__all__
= ['Sweep', 'expand_runs']
funcexpand_runs(base_run, axes, name_template=None) -> list[RunConfig]

Cartesian product of axes over base_run.

Single source of truth for matrix expansion - both Sweep.expand and the YAML loader's _expand_matrix route through here. Empty axes returns [base_run] unchanged.

parambase_runRunConfig
paramaxesdict[str, list[Any]]
paramname_templatestr | None
= None

Returns

list[evsys_sdk.config.RunConfig]
func_render_name(template, binding, axis_names, combo, base_name) -> str
paramtemplatestr | None
parambindingdict[str, str]
paramaxis_nameslist[str]
paramcombotuple[Any, ...]
parambase_namestr

Returns

str
func_render_name_template(template, binding) -> str

Substitute \{dotted.key\} placeholders without going through str.format.

str.format treats dots as attribute access; we just want literal dotted keys.

paramtemplatestr
parambindingdict[str, str]

Returns

str
func_set_dotted(obj, path, value) -> None

Walk a dotted path into a nested-dict tree and set the leaf value.

Always called on a RunConfig.model_dump() result, so every node is a dict; intermediate keys missing on params-style dicts are auto-created (with setdefault), and a typo in a strict path is caught later by RunConfig.model_validate.

paramobjdict
parampathstr
paramvalueAny

Returns

None
func_format_value_for_name(v) -> str
paramvAny

Returns

str