simulator
Simulator
Simulation abstract class
This abstract simulator class defines the minimal methods that must be exported by every simulator in scdesigner. These methods are:
* `fit`: Given an anndata dataset object, estimate the model parameters.
* `predict`: Given experimental and biological features x in the form of
a cell-by-features pd.DataFrame, return the parameters theta(x) of
interest.
* `sample`: Given the same experimental/biological information x as
`predict`, simulate hypothetical profiles associated wtih those
samples.
Example instantiations of this class are given in the module
scdesigner.base.simulators.
Examples:
>>> import scdesigner.datasets
>>>
>>> pancreas = scdesigner.datasets.pancreas()
>>> sim = Simulator()
>>> sim.parameters
>>>
>>> # this is how a subclass would run, once its fit, predict, and sample
>>> # methods are implemented.
>>> sim.fit(pancreas)
>>> sim.predict(pancreas.obs)
>>> sim.sample(pancreas.obs)
Source code in scdesigner/src/scdesigner/base/simulator.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
fit(anndata, **kwargs)
abstractmethod
Fit the simulator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
anndata
|
AnnData
|
This is the object on which we want to estimate the simulator. This serves as the template for all downstream fitting. |
required |
Source code in scdesigner/src/scdesigner/base/simulator.py
40 41 42 43 44 45 46 47 48 49 50 51 | |
predict(obs=None, **kwargs)
abstractmethod
Predict from an obs dataframe
Source code in scdesigner/src/scdesigner/base/simulator.py
53 54 55 56 | |
sample(obs=None, **kwargs)
abstractmethod
Generate samples.
Source code in scdesigner/src/scdesigner/base/simulator.py
58 59 60 61 | |