species_value_in_range#

Ensures that the values in a signal are in valid range or raises an error.

class KeepSpeciesRange(sm: SystemModelInterface, max_retries: int = 10)#

Bases: Constraint

Ensures, that the values are in a valid species-specific range.

Inits the constraint.

Parameters:
  • sm – A PredictionTask, on which the constraint will be applied.

  • max_retries – The maximum number of retries, if the signal is not in the specified range.

Example

>>> from simba_ml.example_problems.sir import sm
>>> from simba_ml.simulation import constraints
>>> constrainted_sm = constraints.KeepSpeciesRange(sm)
apply_noisifier(signal: DataFrame) DataFrame#

Applies the noisifier to a signal but ensures, values stay in correct range.

Parameters:

signal – (pd.DataFrame) The signal.

Returns:

Signal with applied noise.

Return type:

pd.DataFrame

Raises:

MaxRetriesReachedError – if the maximum number of retries was reached without creating an valid signal.

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, float]], Tuple[float, ...]]#

Returns the deriv.

Returns:

The deriv.

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 – If the derivative function should be noised.

Returns:

pd.DataFrame

property kinetic_parameters: Dict[str, KineticParameter[Any]]#

Returns the kinetic_parameters.

Returns:

The kinetic_parameters.

property name: str#

Returns the name.

Returns:

The name.

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

Creates a start_values dict.

Parameters:

n – The number of samples.

Returns:

The start_values dict.

Return type:

dict[str, Any]

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

Returns the specieses.

Returns:

The specieses.

exception MaxRetriesReachedError#

Bases: Exception

Raised when the maximum number of retries is reached.

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.