system_model#

Provides the class to create an actual model of a simulation problem.

class SystemModel(name: str, specieses: list[simba_ml.simulation.species.Species], kinetic_parameters: dict[str, simba_ml.simulation.kinetic_parameters.kinetic_parameter.KineticParameter[KineticParameterType]], deriv: Callable[[float, list[float], dict[str, KineticParameterType]], tuple[float, ...]], sparsifier: Optional[Sparsifier] = None, noiser: Optional[Noiser] = None, deriv_noiser: Optional[DerivNoiser[KineticParameterType]] = None, timestamps: Optional[Distribution[float]] = None, solver_method: str = 'LSODA')#

Bases: object

A SystemModel is the actual model of a problem.

This class solves a system of Ordinary Differential Equations(ODEs) and generates a signal for a specified number of timestamps. The signal can be modified by appliying noise or excluding a fraction of data points. The result can be exported as a csv-file.

kinetic_parameters#

The kinetic parameters of the model.

sparsifier#

A sparsifier randomly removes values from the signal. Can be None.

noiser#

A noisers applies noise to the signal. Can be None.

timestamps#

The number of timestamps the model should be capable of generating data for.

solver_method#

The solver used to solve ODEs. Corresponds to scipy.integrate.solve_ivp(). Default is LSODA.

Inits PredictionTask with the provided params.

Parameters:
  • name – The name of the problem.

  • specieses – A list of specieses.

  • kinetic_parameters – A dictionary of arguments, where the key is the name of the argument.

  • deriv – A function that takes a time, a list of species values and a dictionary of arguments and returns a tuple of derivatives.

  • sparsifier – A sparsifier randomly removes values from the signal. Can be None.

  • noiser – A noisers applies noise to the signal. Can be None.

  • deriv_noiser – A special noisers which applies noise to the derivative. Can be None.

  • timestamps – The number of timestamps the model should be capable of generating data for .

  • solver_method – The solver used to solve ODEs. Corresponds to scipy.integrate.solve_ivp(). Default is LSODA.

apply_noisifier(signal: DataFrame) DataFrame#

Applies the objects noisifier to a signal.

Parameters:

signal – (pd.DataFrame) The signal.

Returns:

Signal with applied noise.

Return type:

pd.DataFrame

apply_sparsifier(signal: DataFrame) DataFrame#

Applies the objects sparsifier to a signal.

Parameters:

signal – (pd.DataFrame) The signal.

Returns:

Signal of reduced features.

Return type:

pd.DataFrame

property deriv: Callable[[float, list[float], dict[str, KineticParameterType]], tuple[float, ...]]#

The derivative of the model.

Returns:

A function that takes a time, a list of species values and a dictionary of arguments and returns a tuple of derivatives.

get_clean_signal(start_values: dict[str, Any], sample_id: int, deriv_noised: bool = True) DataFrame#

Creates a clean signal.

Parameters:
  • start_values – Start values for the simulation.

  • sample_id – The id of the sample.

  • deriv_noised – Whether the derivative function should be noised.

Returns:

A clean signal (possibly the deriv function is noised)

property kinetic_parameters: dict[str, simba_ml.simulation.kinetic_parameters.kinetic_parameter.KineticParameter[KineticParameterType]]#

The model arguments.

Returns:

A dictionary of arguments, where the key is the name of the argument.

property name: str#

The name of the problem.

Returns:

The name of the problem.

sample_species_start_values_from_hypercube(n: int) dict[str, list[float]]#

Samples the start values for the specieses.

Parameters:

n – the number of samples.

Returns:

The start values for the specieses, sampled from a hypercube.

sample_start_values_from_hypercube(n: int) dict[str, Any]#

Samples the start values of the problem.

Parameters:

n – number of start_values to create

Start values are: - number of individuals per species - kinetic_parameters - number of timestamps

Returns:

The start values dict.

Return type:

dict[str, Any]

property specieses: dict[str, simba_ml.simulation.species.Species]#

The species of the model.

Returns:

A dictionary of specieses, where the key is the name of the species.