designspace.ParamDef#

class designspace.ParamDef(path: str, type_kind: Literal['real', 'integer', 'categorical', 'ordinal', 'bool', 'subset', 'permutation', 'choice', 'space', 'custom', 'symbolic', 'code', 'list'], domain: RealDomain | IntegerDomain | CategoricalDomain | OrdinalDomain | BoolDomain | SubsetDomain | PermutationDomain | ChoiceDomain | StructDomain | CustomDomain | SymbolicDomain | CodeDomain | ListDomain, prior: Prior | Log | Logit | Power | Weights | None, periodic: bool, default: Any, condition: BoolExpr | None, tags: frozenset[str], meta: MappingProxyType, chart: Chart | None = None, quantized: QuantizedSpec | None = None)#

Bases: object

One resolved parameter: the introspection surface.

What Space.params[path] holds, and what a solver reads to decide how to treat a parameter. Unlike the builder objects, which carry half-finished state, a ParamDef is complete and checked.

The IR is bidirectional: ds.param_from_def() turns one back into a builder, and ds.space_from_ir() rebuilds a whole space from these, which is what makes programmatic space construction ordinary rather than special.

path#

The parameter’s full path, such as “opt.sgd.momentum”.

Type:

str

type_kind#

The kind, as a string: “real”, “integer”, “bool”, “categorical”, “ordinal”, “subset”, “permutation”, “choice”, “space”, “list”, “custom”, “symbolic”, “code”.

Type:

str

domain#

The declared value space.

Type:

Domain

prior#

The declared prior, or None for the default uniform measure.

Type:

PriorSpec | None

periodic#

Whether the domain wraps, so its endpoints are the same point.

Type:

bool

default#

The fill value used by apply_defaults, or None if unset.

Type:

Any

condition#

When the parameter is active. None means unconditionally active.

Type:

BoolExpr | None

tags#

Labels attached by .tag().

Type:

frozenset[str]

meta#

Metadata attached by .meta(). Never interpreted.

Type:

MappingProxyType[str, Any]

chart#

The map from [0, 1] onto the domain, for a generative scalar. None for a non-generative parameter and for a lift, since a lifted parameter’s chart is on ListDomain.element_chart.

Type:

Chart | None

quantized#

The grid, if the parameter is quantized.

Type:

QuantizedSpec | None

Examples

>>> s = ds.space(ds.param("depth").integer(1, 8))
>>> pd = s.params["depth"]
>>> pd.path, pd.type_kind
('depth', 'integer')
>>> pd.domain
IntegerDomain(lo=1, hi=8)