phenotypic.tune.TuneSpec#
- class phenotypic.tune.TuneSpec(low: float | None = None, high: float | None = None, *, step: float | None = None, log: bool = False, categories: tuple | None = None, tunable: bool = True)[source]#
Bases:
objectPer-field tuning-search metadata (Tier-1 inference override).
TuneSpecmirrors the existing field-marker pattern (_ColumnRefMarker,_OperationFieldMarker): a frozen, slotted, non-pydantic sentinel that is a complete no-op at runtime and is read only byinfer_search_space, viaop.model_fields[name].metadata(where pydantic v2 storesAnnotatedextras). It rides in anAnnotated[T, TuneSpec(...)]chain:class GaussianBlur(ImageEnhancer): sigma: Annotated[float, TuneSpec(0.5, 5.0, log=True)] = 2.0 truncate: Annotated[float, TuneSpec(tunable=False)] = 4.0
At runtime
sigmais still a plainfloat;GaussianBlur(sigma=999.0)constructs exactly as before. The marker is the search domain, never the valid domain — validity stays the job of pydanticField(ge=, le=).It lives here (not in
phenotypic.tune) so operation modules can import it without dragging in the tune engine — the public re-exportfrom phenotypic.tune import TuneSpecstill works.- Parameters:
low (float | None) – Inclusive lower search bound (positional).
Noneleaves the bound to Tier-2 inference / the co-locatedFieldconstraint.high (float | None) – Inclusive upper search bound (positional).
Noneaslow.step (float | None) – Discretization stride — integer step or quantized float.
Nonemeans continuous (or unit-step for integers).log (bool) – Whether to sample on a logarithmic scale (default
False).categories (tuple | None) – Override / subset the auto-derived categorical choices. A list is coerced to a tuple so the marker stays hashable.
tunable (bool) –
Falseexcludes the field from tuning outright and short-circuits Tier-2 (defaultTrue).
Note
This is not a pydantic model — it is a plain slotted sentinel so it can sit in an
Annotatedchain without pydantic trying to validate it. It carries__eq__/__hash__over the full field tuple so a duplicate in anAnnotatedchain de-dupes (PEP 593 chain semantics).Methods
__init__Attributes