CADETProcess.parameter_space.TransformedSpace#
- class CADETProcess.parameter_space.TransformedSpace(space: ParameterSpace)[source]#
Bases:
objectOptimizer-facing view of a
ParameterSpacein normalized coordinates.All bounds and constraint matrices are expressed in the normalized coordinate system. The underlying
ParameterSpaceis the source of truth;TransformedSpacederives everything from it lazily. Every method is a pure function: writing goes throughParameterSpaceexclusively.- Parameters:
- spaceParameterSpace
The physical-unit parameter space this view wraps.
Examples
space = ParameterSpace() space.add_evaluation_object(process) space.add_parameter( RangedParameter("length", float, lb=0.1, ub=1.0, normalization="linear"), path="column.length", ) ts = TransformedSpace(space) # 0.5 normalized → 0.55 physical space.set_values(ts.decode(space.denormalize([0.5])))
- check_bounds(x: ArrayLike, tol: float | ArrayLike = 0.0) bool[source]#
Return True when x (in normalized coordinates) satisfies physical bounds.
- Parameters:
- xarray-like
Values for the independent parameters in normalized coordinates.
- tolfloat or array-like
Per-variable tolerance added to each bound before checking.
- decode(x_num: ArrayLike, categorical_values: Mapping[str, Any] | None = None) dict[str, Any][source]#
Embed a numeric parameter vector into a named assignment.
The returned assignment carries canonical Python types:
intfor integer parameters (rounded),floatfor continuous ones, plus the caller-supplied categorical values. When the space contains categorical parameters, the assignment cannot be reconstructed from the vector alone; categorical_values must supply every categorical parameter.- Parameters:
- x_numarray-like
Values of the independent numeric parameters in physical units, in registration order.
- categorical_valuesMapping, optional
Values for the categorical parameters. Required when the space contains categorical parameters; must cover exactly those.
- Returns:
- dict
Named physical assignment of the independent parameters, ordered by registration.
- Raises:
- ValueError
If the vector length does not match the number of independent numeric parameters, if categorical_values contains unknown names, or if it misses a categorical parameter (including the case where the space has categorical parameters and categorical_values is None).
- encode(assignment: Mapping[str, Any]) ndarray[source]#
Project a named assignment onto the numeric parameter vector.
The vector spans the independent numeric parameters in registration order. Dependent and categorical parameters have no vector position; their entries are dropped (
encodeis a lossy projection).- Parameters:
- assignmentMapping
Named values in physical units. Must contain every independent numeric parameter; registered dependent or categorical names are ignored.
- Returns:
- np.ndarray
Values of the independent numeric parameters, in physical units.
- Raises:
- ValueError
If the assignment contains unknown names or misses an independent numeric parameter.
- property evaluation_objects: list[Any]#
Registered evaluation objects (delegates to the underlying space).
- get_dependent_values(x: ArrayLike) ndarray[source]#
Expand normalized independent values to the full physical parameter vector.
- Parameters:
- xarray-like
Values for the
n_variablesindependent parameters in normalized coordinates.
- Returns:
- np.ndarray
Full physical parameter vector of length
n_parameters.
- property independent_parameters: list[ParameterBase]#
Independent (optimizer-facing) parameters.
- property lower_bounds: ndarray#
Lower bounds in the optimizer coordinate system.
Each value is the per-parameter normalization of the physical lower bound. Parameters with an active normalizer and finite bounds return 0; parameters without normalization pass through the identity chart and retain their physical-unit value. The result is a mixed-coordinate vector: axes are not globally comparable.
- property parameters: list[ParameterBase]#
All registered parameters (delegates to the underlying space).
- property space: ParameterSpace#
The underlying
ParameterSpace.
- property upper_bounds: ndarray#
Upper bounds in the optimizer coordinate system.
Each value is the per-parameter normalization of the physical upper bound. Parameters with an active normalizer and finite bounds return 1; parameters without normalization pass through the identity chart and retain their physical-unit value. The result is a mixed-coordinate vector: axes are not globally comparable.
- validate_x(x: ArrayLike, tol: float = 0.0, tol_eq: float = 1e-06) bool | ndarray[source]#
Return True if x (normalized) satisfies bounds and all linear constraints.
- Parameters:
- xarray-like
Normalized independent parameter vector, shape
(n_variables,)for a single point or(m, n_variables)for a population.- tolfloat
Tolerance applied to bounds and inequality constraints (inclusive).
- tol_eqfloat
Tolerance applied to equality constraints.
- Returns:
- bool or np.ndarray of bool
Scalar for a single point; 1-D boolean array for a population.