sbmlsim.fit
¶
Package for parameter fitting.
For additional resources see for instance https://pyabc.readthedocs.io/en/latest/index.html
Submodules¶
Package Contents¶
Classes¶
Mapping of reference data to observable data. |
|
Data used in a fit. |
|
A parameter fitting experiment. |
|
Parameter adjusted in a parameter optimization. |
- class sbmlsim.fit.FitMapping(experiment, reference, observable, weight=None, metadata=None)[source]¶
Mapping of reference data to observable data.
In the optimization the difference between the reference data (ground truth) and the observable (predicted data) is minimized. The weight allows to weight the FitMapping.
- Parameters
- property weight(self)¶
Return defined weight or count of the reference.
- Return type
float
- class sbmlsim.fit.FitData(experiment, xid, yid, xid_sd=None, xid_se=None, yid_sd=None, yid_se=None, count=None, dataset=None, task=None, function=None)[source]¶
Data used in a fit.
This is either data from a dataset, a simulation results from a task or functional data, i.e. calculated from other data.
- Parameters
experiment (Any) –
xid (str) –
yid (str) –
xid_sd (Optional[str]) –
xid_se (Optional[str]) –
yid_sd (Optional[str]) –
yid_se (Optional[str]) –
count (Optional[Union[int, str]]) –
dataset (Optional[str]) –
task (Optional[str]) –
function (Optional[str]) –
- is_task(self)¶
Check if FitData comes from a task (simulation).
- Return type
bool
- is_dataset(self)¶
Check if FitData comes from a dataset.
- Return type
bool
- is_function(self)¶
Check if FitData comes from a function.
- Return type
bool
- property dtype(self)¶
Get data type.
- get_data(self)¶
Return actual data.
Numerical values are resolved using the executed simulation experiment.
- Return type
- class sbmlsim.fit.FitExperiment(experiment, mappings=None, weights=None, use_mapping_weights=False, fit_parameters=None)[source]¶
A parameter fitting experiment.
A parameter fitting experiment consists of multiple mapping (reference data to observable). The individual mappings can be weighted differently in the fitting.
- Parameters
experiment (Callable) –
mappings (List[str]) –
weights (Union[float, List[float]]) –
use_mapping_weights (bool) –
fit_parameters (Dict[str, List[FitParameter]]) –
- property weights(self)¶
Weights of fit mappings.
- Return type
List[float]
- static reduce(fit_experiments)¶
Collect fit mappings of multiple FitExperiments if these can be combined.
- Parameters
fit_experiments (Iterable[FitExperiment]) –
- Return type
List[FitExperiment]
- __repr__(self)¶
Get representation.
- Return type
str
- __str__(self)¶
Get string.
- Return type
str
- class sbmlsim.fit.FitParameter(pid, start_value=None, lower_bound=- np.Inf, upper_bound=np.Inf, unit=None)[source]¶
Parameter adjusted in a parameter optimization.
The bounds define the box in which the parameter can be varied. The start value is the initial value in the parameter fitting for algorithms which use it.
- Parameters
pid (str) –
start_value (float) –
lower_bound (float) –
upper_bound (float) –
unit (str) –
- __eq__(self, other)¶
Check for equality.
Uses math.isclose for all comparisons of numerical values.
- Parameters
other (object) –
- Return type
bool
- __repr__(self)¶
Get string representation.
- Return type
str
- to_json(self, path=None)¶
Serialize to JSON.
Serializes to file if path is provided, otherwise returns JSON string.
- Parameters
path (pathlib.Path) –
- Return type
Optional[str]
- static from_json(json_info)¶
Load from JSON.
- Parameters
json_info (Union[str, pathlib.Path]) –
- Return type