Module space
Expand description
Search spaces: values, distributions, transforms, schemas.
The layer is four types deep and no deeper:
| Type | Answers |
|---|---|
ParamValue | what one parameter is set to, with its type intact |
Distribution | which values are legal, and how to map them to [0, 1] |
Assignment | what a whole trial was set to (sorted by name) |
SpaceSchema | which 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’sf64union suffers). - There is exactly one transform layer.
Distribution::to_unitandDistribution::from_unitare 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.
- Growth
Decision - One growth decision the replay took, in the order it took them — the
record the study loop turns into a
StudyEventand anatune runline, and the doctor turns into a finding. Carries the parameter name (this is an in-process record, not theCopyevent; §13.2’s name-sorted index is derived by the emitter). - Growth
Replay - 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.
- Param
Spec - One declared parameter: a name and its support.
- Space
Policy - A study’s growth policy: which parameters are open, and how – one
Openper name, inBTreeMapname order for the same determinism reasoncrate::space::Assignmentdocuments. Serializes transparently as that name-to-policy map, with no extra wrapper layer. - Space
Schema - An ordered set of declared parameters.
Enums§
- Band
- The crowding band at one side of a distribution — see
band. - CatChoice
Value - One categorical choice’s durable scalar payload.
- Distribution
- The support of one parameter.
- Growth
Reason - Why a growth decision was taken or refused – §9’s brakes and the two outcomes of its failure veto.
- Limit
Bound - One side of an
Open::limitcall – which end of the stored limit a range argument sets. Never named by a caller: spelled with..=/..on the standard range types (§6.5). - Param
Value - 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’saround, one function name covering both scales via which keyword it is given. - Value
Kind - The kind of a
ParamValue, without its payload.
Constants§
- MAX_
GRID_ POINTS - The largest grid
Distribution::grid_valueswill materialize.
Traits§
- Space
- A typed configuration that doubles as a search space.
Functions§
- band
- The crowding band at
sideofdist— §8.5. - pressure
- The crowding fraction on
side: the share of the top set thatbandcounts as “at the bound” there — §8.1’spressure(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
pressuremeasures 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 widenover an already-advanced replay — the cache path: the study handle keeps oneGrowthReplaybeside its view and advances it per decision point, so the rule replays over new trials only (§10.3).