sbmlsim.fit.objects

Definition of Objects used in FitProblems and optimization.

Module Contents

Classes

FitExperiment

A parameter fitting experiment.

MappingMetaData

Metadata for mapping.

FitMapping

Mapping of reference data to observable data.

FitParameter

Parameter adjusted in a parameter optimization.

FitData

Data used in a fit.

FitDataInitialized

Initialized FitData with actual data content.

Attributes

logger

sbmlsim.fit.objects.logger[source]
class sbmlsim.fit.objects.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][source]

Weights of fit mappings.

Return type:

List[float]

static reduce(fit_experiments)[source]

Collect fit mappings of multiple FitExperiments if these can be combined.

Parameters:

fit_experiments (Iterable[FitExperiment]) –

Return type:

List[FitExperiment]

__repr__()[source]

Get representation.

Return type:

str

__str__()[source]

Get string.

Return type:

str

class sbmlsim.fit.objects.MappingMetaData[source]

Metadata for mapping.

class sbmlsim.fit.objects.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: float[source]

Return defined weight or count of the reference.

Return type:

float

__str__()[source]

Get string.

Return type:

str

class sbmlsim.fit.objects.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)[source]

Check for equality.

Uses math.isclose for all comparisons of numerical values.

Parameters:

other (object) –

Return type:

bool

__repr__()[source]

Get string representation.

Return type:

str

to_json(path=None)[source]

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)[source]

Load from JSON.

Parameters:

json_info (Union[str, pathlib.Path]) –

Return type:

FitParameter

class sbmlsim.fit.objects.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[source]

Get data type.

__str__()[source]

Get string.

Return type:

str

is_task()[source]

Check if FitData comes from a task (simulation).

Return type:

bool

is_dataset()[source]

Check if FitData comes from a dataset.

Return type:

bool

is_function()[source]

Check if FitData comes from a function.

Return type:

bool

get_data()[source]

Return actual data.

Numerical values are resolved using the executed simulation experiment.

Return type:

FitDataInitialized

class sbmlsim.fit.objects.FitDataInitialized[source]

Initialized FitData with actual data content.

Data is create from simulation experiment.

__str__()[source]

Get string representation.

Return type:

str