amici.parameter_mapping
Parameter mapping
When performing parameter inference, often parameters need to be mapped from simulation to estimation parameters, and parameters can differ between conditions. This can be handled using the ParameterMapping.
Note
While the parameter mapping can be used directly with AMICI, it was developed for usage together with PEtab, for which the whole workflow of generating the mapping is automatized.
Functions
|
Convert amici scale id to petab scale id. |
|
Fill fixed and dynamic parameters into the edatas (in-place). |
|
Fill fixed and dynamic parameters into the edata for condition (in-place). |
|
Convert petab scale id to amici scale id. |
|
Bring parameter from linear scale to target scale. |
|
Bring parameters from linear scale to target scale. |
|
Bring parameter from scale to linear scale. |
|
Bring parameters from target scale to linear scale. |
Classes
|
Parameter mapping for multiple conditions. |
|
Parameter mapping for condition. |
- class amici.parameter_mapping.ParameterMapping(parameter_mappings=None)[source]
Parameter mapping for multiple conditions.
This can be used like a list of
ParameterMappingForCondition
s.- Parameters
parameter_mappings (
typing.Optional
[typing.List
[amici.parameter_mapping.ParameterMappingForCondition
]]) – List of parameter mappings for specific conditions.
- class amici.parameter_mapping.ParameterMappingForCondition(map_sim_var=None, scale_map_sim_var=None, map_preeq_fix=None, scale_map_preeq_fix=None, map_sim_fix=None, scale_map_sim_fix=None)[source]
Parameter mapping for condition.
Contains mappings for free parameters, fixed parameters, and fixed preequilibration parameters, both for parameters and scales.
In the scale mappings, for each simulation parameter the scale on which the value is passed (and potentially gradients are to be returned) is given. In the parameter mappings, for each simulation parameter a corresponding optimization parameter (or a numeric value) is given.
If a mapping is not passed, the parameter mappings are assumed to be empty, and if a scale mapping is not passed, all scales are set to linear.
- Parameters
map_sim_var (
typing.Optional
[typing.Dict
[str
,typing.Union
[str
,numbers.Number
]]]) – Mapping for free simulation parameters.scale_map_sim_var (
typing.Optional
[typing.Dict
[str
,str
]]) – Scales for free simulation parameters.map_preeq_fix (
typing.Optional
[typing.Dict
[str
,typing.Union
[str
,numbers.Number
]]]) – Mapping for fixed preequilibration parameters.scale_map_preeq_fix (
typing.Optional
[typing.Dict
[str
,str
]]) – Scales for fixed preequilibration parameters.map_sim_fix (
typing.Optional
[typing.Dict
[str
,typing.Union
[str
,numbers.Number
]]]) – Mapping for fixed simulation parameters.scale_map_sim_fix (
typing.Optional
[typing.Dict
[str
,str
]]) – Scales for fixed simulation parameters.
- amici.parameter_mapping.amici_to_petab_scale(amici_scale)[source]
Convert amici scale id to petab scale id.
- Return type
- amici.parameter_mapping.fill_in_parameters(edatas, problem_parameters, scaled_parameters, parameter_mapping, amici_model)[source]
Fill fixed and dynamic parameters into the edatas (in-place).
- Parameters
edatas (
typing.List
[amici.swig_wrappers.ExpData
]) – List of experimental datasamici.amici.ExpData
with everything except parameters filled.problem_parameters (
typing.Dict
[str
,numbers.Number
]) – Problem parameters as parameterId=>value dict. Only parameters included here will be set. Remaining parameters will be used as currently set in amici_model.scaled_parameters (
bool
) – If True, problem_parameters are assumed to be on the scale provided in the parameter mapping. If False, they are assumed to be in linear scale.parameter_mapping (
amici.parameter_mapping.ParameterMapping
) – Parameter mapping for all conditions.amici_model (
typing.Union
[amici.amici.Model
,amici.amici.ModelPtr
]) – AMICI model.
- Return type
- amici.parameter_mapping.fill_in_parameters_for_condition(edata, problem_parameters, scaled_parameters, parameter_mapping, amici_model)[source]
Fill fixed and dynamic parameters into the edata for condition (in-place).
- Parameters
edata (
amici.swig_wrappers.ExpData
) – Experimental data object to fill parameters into.problem_parameters (
typing.Dict
[str
,numbers.Number
]) – Problem parameters as parameterId=>value dict. Only parameters included here will be set. Remaining parameters will be used as already set in amici_model and edata.scaled_parameters (
bool
) – If True, problem_parameters are assumed to be on the scale provided in the parameter mapping. If False, they are assumed to be in linear scale.parameter_mapping (
amici.parameter_mapping.ParameterMappingForCondition
) – Parameter mapping for current condition.amici_model (
typing.Union
[amici.amici.Model
,amici.amici.ModelPtr
]) – AMICI model
- Return type
- amici.parameter_mapping.petab_to_amici_scale(petab_scale)[source]
Convert petab scale id to amici scale id.
- Return type
- amici.parameter_mapping.scale_parameter(value, petab_scale)[source]
Bring parameter from linear scale to target scale.
- Parameters
value (
numbers.Number
) – Value to scalepetab_scale (
str
) – Target scale ofvalue
- Return type
- Returns
value
on target scale
- amici.parameter_mapping.scale_parameters_dict(value_dict, petab_scale_dict)[source]
Bring parameters from linear scale to target scale.
Bring values in
value_dict
from linear scale to the scale provided inpetab_scale_dict
(in-place). Both arguments are expected to have the same length and matching keys.- Parameters
value_dict (
typing.Dict
[typing.Any
,numbers.Number
]) – Values to scalepetab_scale_dict (
typing.Dict
[typing.Any
,str
]) – Target scales ofvalues
- Return type
- amici.parameter_mapping.unscale_parameter(value, petab_scale)[source]
Bring parameter from scale to linear scale.
- Parameters
value (
numbers.Number
) – Value to scalepetab_scale (
str
) – Target scale ofvalue
- Return type
- Returns
value
on linear scale
- amici.parameter_mapping.unscale_parameters_dict(value_dict, petab_scale_dict)[source]
Bring parameters from target scale to linear scale.
Bring values in
value_dict
from linear scale to the scale provided inpetab_scale_dict
(in-place). Both arguments are expected to have the same length and matching keys.- Parameters
value_dict (
typing.Dict
[typing.Any
,numbers.Number
]) – Values to scalepetab_scale_dict (
typing.Dict
[typing.Any
,str
]) – Target scales ofvalues
- Return type