Skip to main content

Module space

Module space 

Expand description

Search spaces: values, distributions, transforms, schemas.

The layer is four types deep and no deeper:

TypeAnswers
ParamValuewhat one parameter is set to, with its type intact
Distributionwhich values are legal, and how to map them to [0, 1]
Assignmentwhat a whole trial was set to (sorted by name)
SpaceSchemawhich parameters a study declares (in declaration order)

Two invariants run through all of them — the guide states them under the four kinds of parameter:

  • Parameters are identified by stable string names, values are typed. Nothing is keyed on declaration order (the footgun that global-counter designs hit), and a boolean never becomes the integer 1 (the collapse that Optuna’s f64 union suffers).
  • There is exactly one transform layer. Distribution::to_unit and Distribution::from_unit are the only implementations of log scaling, step snapping and categorical indexing in the codebase; a sampler that wants numeric vectors goes through them explicitly.

Declared conditional parameters (enabled_if) do not exist; a conditional is written define-by-run, by suggesting a parameter only on the branch that uses it.

Modules§

dsl
The string DSL: a compact text notation for a Distribution.

Structs§

Assignment
The parameters of one trial: names to typed values.
CatChoices
The labels and typed scalar payloads of a categorical parameter, in a fixed order.
GrowthDecision
One growth decision the replay took, in the order it took them — the record the study loop turns into a StudyEvent and an atune run line, and the doctor turns into a finding. Carries the parameter name (this is an in-process record, not the Copy event; §13.2’s name-sorted index is derived by the emitter).
GrowthReplay
The growth rule replayed from the seed — §10’s derived-by-replay state, advanced incrementally per §10.3’s two cache rules (evaluate every decision point in an interval; roll back and re-advance when a gap fills below the watermark). Pure over the finished prefix it has consumed: advancing twice over the same view is a no-op, and a cold replay of the same trials produces the identical state (warm == cold, unconditionally).
Open
One parameter’s declared growth policy: the seed it starts from, which side(s) may move, and the numbers that govern and bound that movement.
ParamSpec
One declared parameter: a name and its support.
SpacePolicy
A study’s growth policy: which parameters are open, and how – one Open per name, in BTreeMap name order for the same determinism reason crate::space::Assignment documents. Serializes transparently as that name-to-policy map, with no extra wrapper layer.
SpaceSchema
An ordered set of declared parameters.

Enums§

Band
The crowding band at one side of a distribution — see band.
CatChoiceValue
One categorical choice’s durable scalar payload.
Distribution
The support of one parameter.
GrowthReason
Why a growth decision was taken or refused – §9’s brakes and the two outcomes of its failure veto.
LimitBound
One side of an Open::limit call – which end of the stored limit a range argument sets. Never named by a caller: spelled with ..=/.. on the standard range types (§6.5).
ParamValue
One parameter’s value, typed.
Scale
Whether a numeric range is walked linearly or logarithmically.
Side
Which end of a numeric range a measurement is about.
Sides
Which side(s) of a distribution a growth policy permits to move.
Spread
How Open::around’s seed is derived from a center value – §6.1’s around, one function name covering both scales via which keyword it is given.
ValueKind
The kind of a ParamValue, without its payload.

Constants§

MAX_GRID_POINTS
The largest grid Distribution::grid_values will materialize.

Traits§

Space
A typed configuration that doubles as a search space.

Functions§

band
The crowding band at side of dist — §8.5.
pressure
The crowding fraction on side: the share of the top set that band counts as “at the bound” there — §8.1’s pressure(side S) = |{ t in top set : t is in band(dist, S) }| / |top set|.
top_set
The completed trials that vote on where a study’s optimum is — §8’s candidate and top-set construction. Reused across every parameter: the same top set is what pressure measures crowding against for each open parameter in turn, so a caller builds it once per decision point rather than once per parameter.
widen
§12.1’s interposition: the ask-time space with every policy-open parameter’s live (replayed) range in place of its seed — plus §10.4’s injection, which adds a policy-declared parameter the inferred space does not carry (the define-by-run bootstrap: the policy is a partial declared space).
widen_with
widen over an already-advanced replay — the cache path: the study handle keeps one GrowthReplay beside its view and advances it per decision point, so the rule replays over new trials only (§10.3).