Parameter
- class glotaran.parameter.parameter.Parameter(label: str = None, full_label: str = None, expression: str | None = None, maximum: float = inf, minimum: float = - inf, non_negative: bool = False, standard_error: float = nan, value: float = nan, vary: bool = True)[source]
Bases:
numpy.typing._array_like._SupportsArray
A parameter for optimization.
Optimization Parameter supporting numpy array operations.
- Parameters
label (str) – The label of the parameter., by default None
full_label (str) – The label of the parameter with its path in a parameter group prepended. , by default None
expression (str | None) – Expression to calculate the parameters value from, e.g. if used in relation to another parameter. , by default None
maximum (float) – Upper boundary for the parameter to be varied to., by default np.inf
minimum (float) – Lower boundary for the parameter to be varied to., by default -np.inf
non_negative (bool) – Whether the parameter should always be bigger than zero., by default False
standard_error (float) – The standard error of the parameter. , by default
np.nan
value (float) – Value of the parameter, by default np.nan
vary (bool) – Whether the parameter should be changed during optimization or not. , by default True
Attributes Summary
Expression to calculate the parameters value from.
Label of the parameter with its path in a parameter group prepended.
Label of the parameter.
Upper bound of the parameter.
Lower bound of the parameter.
Indicate if the parameter is non-negative.
Standard error of the optimized parameter.
Expression of the parameter transformed for evaluation within a ParameterGroup.
Value of the parameter.
Indicate if the parameter should be optimized.
Methods Summary
Create a dictionary containing the parameter properties.
Create a
Parameter
from a dictionary.Create a parameter from a list or numeric value.
Get the parameter value and bounds with expression and non-negative constraints applied.
Get a markdown representation of the parameter.
Set all values of the parameter to the values of the corresponding parameter in the group.
Set the value from an optimization result and reverses non-negative transformation.
Check if a label is a valid label for
Parameter
.Methods Documentation
- as_dict(as_optimized: bool = True) dict[str, Any] [source]
Create a dictionary containing the parameter properties.
- property expression: str | None
Expression to calculate the parameters value from.
This can used to set a relation to another parameter.
- classmethod from_dict(parameter_dict: dict[str, Any]) Parameter [source]
Create a
Parameter
from a dictionary.Expects a dictionary created by :method:`Parameter.as_dict`.
- classmethod from_list_or_value(value: int | float | list, default_options: dict = None, label: str = None) Parameter [source]
Create a parameter from a list or numeric value.
- property full_label: str
Label of the parameter with its path in a parameter group prepended.
- Returns
The full label.
- Return type
- get_value_and_bounds_for_optimization() tuple[float, float, float] [source]
Get the parameter value and bounds with expression and non-negative constraints applied.
- markdown(all_parameters: ParameterGroup | None = None, initial_parameters: ParameterGroup | None = None) MarkdownStr [source]
Get a markdown representation of the parameter.
- Parameters
all_parameters (ParameterGroup | None) – A parameter group containing the whole parameter set (used for expression lookup).
initial_parameters (ParameterGroup | None) – The initial parameter.
- Returns
The parameter as markdown string.
- Return type
- property maximum: float
Upper bound of the parameter.
- Returns
The upper bound of the parameter.
- Return type
- property minimum: float
Lower bound of the parameter.
- Returns
The lower bound of the parameter.
- Return type
- property non_negative: bool
Indicate if the parameter is non-negative.
If true, the parameter will be transformed with and .
Notes
Always False if expression is not None.
- Returns
Whether the parameter is non-negative.
- Return type
- set_from_group(group: ParameterGroup)[source]
Set all values of the parameter to the values of the corresponding parameter in the group.
Notes
For internal use.
- Parameters
group (ParameterGroup) – The
glotaran.parameter.ParameterGroup
.
- set_value_from_optimization(value: float)[source]
Set the value from an optimization result and reverses non-negative transformation.
- Parameters
value (float) – Value from optimization.
- property standard_error: float
Standard error of the optimized parameter.
- Returns
The standard error of the parameter.
- Return type
- property transformed_expression: str | None
Expression of the parameter transformed for evaluation within a ParameterGroup.