piglot.parameter.DualParameterSet
- class DualParameterSet[source]
Bases:
ParameterSetContainer class for a set of parameters with distinct internal and output parameters.
This type should be used if the internal optimised parameters and the output parameters are not equal. Output names are used for output name resolution. All output fields must have a mapping function to internal parameters.
Methods
Add a parameter to this set.
Adds an output parameter to the set.
Clamp the parameter set to the [lbound,ubound] interval.
Creates an output parameter identical to a given internal parameter.
Build the hash for the current parameter values.
Build a dict with name-value pairs for output parameters given a list of values.
Compute the output parameters' values given an array of internal inputs.
- add(name: str, inital_value: float, lbound: float, ubound: float) None
Add a parameter to this set.
Parameters
- namestr
Parameter name.
- inital_valuefloat
Initial value for the parameter.
- lboundfloat
Lower bound of the parameter.
- uboundfloat
Upper bound of the parameter.
Raises
- RuntimeError
If a repeated parameter is given.
- add_output(name: str, mapping: Callable[[Dict[str, float]], float]) None[source]
Adds an output parameter to the set.
Parameters
- namestr
Parameter name
- mappingCallable[[Dict[str, float]], float]
Mapping function from internal parameters to this output parameter’s value. Internal parameters are passed as arguments for this function as an expanded dict.
Raises
- RuntimeError
If an output parameter is repeated.
- clip(values: ndarray) ndarray
Clamp the parameter set to the [lbound,ubound] interval.
Parameters
- valuesnp.ndarray
Values to clip. Their order is used for parameter resolution.
Returns
- np.ndarray
Clamped parameters.
- clone_output(name: str) None[source]
Creates an output parameter identical to a given internal parameter.
Parameters
- namestr
Name of the internal parameter to clone.
- static hash(values) str
Build the hash for the current parameter values.
Parameters
- valuesarray
Parameters to hash.
Returns
- str
Hex digest of the hash.