simulator#

Simulate virtual experimental data

Classes

Simulator(X_space, response_function[, ...])

Simulator class for generating in-silico responses to requested experiments.

class obsidian.experiment.simulator.Simulator(X_space: ParamSpace, response_function: Callable, name: str | list[str] = 'Response', eps: float | list[float] = 0.0, rng: Generator | RNGManager | int | None = None, apply_noise: Callable | None = None, **kwargs)[source]#

Bases: object

Simulator class for generating in-silico responses to requested experiments.

This class provides functionality to simulate responses to a set of experiments based on a given response function. The simulated responses can be subject to error, which is controlled by the eps parameter.

X_space#

The ParamSpace object representing the allowable space for optimization.

Type:

ParamSpace

response_function#

The callable function used to convert experiments to responses.

Type:

Callable

name#

Name of the simulated output(s). Default is Response.

Type:

str or list[str]

eps#

The simulated error to apply, as the standard deviation of the Standard Normal distribution. Default is 0.

Type:

float or list[float]

apply_noise#

Optional custom function to apply noise to the simulated response. If None, uses default multiplicative Gaussian noise. Must have signature:

apply_noise(X, y_sim, eps, rng) -> y_with_noise

Where X is the input array, y_sim is the noiseless simulation output with shape (n_samples, n_outputs), eps is the noise parameter array with shape (1, n_eps), and rng is the numpy random Generator. Must return array with same shape as y_sim.

Type:

Callable | None

kwargs#

Optional hyperparameters for the response function.

Type:

dict

Raises:
  • TypeError – If response_function is not a callable function.

  • TypeError – If X_space is not an obsidian ParamSpace object.

simulate(X_prop: DataFrame) DataFrame[source]#

Generates a response to a set of experiments.

Currently, response function only handles strictly numeric values and categories are manually penalized.

Parameters:

X_prop (pd.DataFrame) – Proposed experiments to evaluate.

Returns:

DataFrame of response values to experiments.

Return type:

pd.DataFrame