sbmlsim.fit
¶
Package for parameter fitting.
For additional resources see for instance https://pyabc.readthedocs.io/en/latest/index.html
Subpackages¶
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:
experiment (Any) –
reference (FitData) –
observable (FitData) –
weight (float) –
metadata (MappingMetaData) –
- property weight: float¶
Return defined weight or count of the reference.
- Return type:
float
- __str__()¶
Get string.
- Return type:
str
- 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]) –
- property dtype¶
Get data type.
- __str__()¶
Get string.
- Return type:
str
- is_task()¶
Check if FitData comes from a task (simulation).
- Return type:
bool
- is_dataset()¶
Check if FitData comes from a dataset.
- Return type:
bool
- is_function()¶
Check if FitData comes from a function.
- Return type:
bool
- get_data()¶
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, exclude=False)[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]]) –
exclude (bool) –
- property weights: List[float]¶
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__()¶
Get representation.
- Return type:
str
- __str__()¶
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__(other)¶
Check for equality.
Uses math.isclose for all comparisons of numerical values.
- Parameters:
other (object) –
- Return type:
bool
- __repr__()¶
Get string representation.
- Return type:
str
- to_json(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: