Treatment
module crystallize.experiments.treatment
Section titled “module crystallize.experiments.treatment”class Treatment
Section titled “class Treatment”Set up initial context values for a replicate.
Unlike plugins, a treatment does not hook into the execution lifecycle; it simply mutates the :class:FrozenContext before the pipeline starts. The apply argument can be a callable or a mapping providing the context additions.
Args:
name: Human-readable identifier for the treatment.apply: Either a callableapply(ctx)or a mapping of keys to insert. Existing keys must not be mutated—FrozenContextenforces this immutability.
method Treatment.__init__
Section titled “method Treatment.__init__”__init__( name: str, apply: Union[Callable[[crystallize.utils.context.FrozenContext], Any], Mapping[str, Any]])property Treatment.apply_map
Section titled “property Treatment.apply_map”method Treatment.apply
Section titled “method Treatment.apply”apply(ctx: crystallize.utils.context.FrozenContext) → NoneApply the treatment to the execution context.
Implementations typically add new keys like:
ctx[‘embed_dim’] = 512 ctx.override(step=‘hpo’, param_space={‘lr’: [1e-4, 5e-5]})
Raises: ContextMutationError if attempting to overwrite existing keys.