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:
objectOne 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.
- type_kind#
The kind, as a string: “real”, “integer”, “bool”, “categorical”, “ordinal”, “subset”, “permutation”, “choice”, “space”, “list”, “custom”, “symbolic”, “code”.
- Type:
- default#
The fill value used by apply_defaults, or None if unset.
- Type:
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)