mass.thermo.conc_sampling.conc_sampling
Module implementing concentration sampling for mass
models.
Based on sampling implementations in cobra.sampling.sampling
Module Contents
Functions
|
Sample valid concentration distributions from a |
- mass.thermo.conc_sampling.conc_sampling.sample_concentrations(concentration_solver, n, method='optgp', thinning=100, processes=1, seed=None)[source]
Sample valid concentration distributions from a
mass
model.This function samples valid concentration distributions from a
mass
model using aConcSolver
.Currently supports two methods.
'optgp'
which uses theConcOptGPSampler
that supports parallel sampling [MHM14]. Requires large numbers of samples to be performant (n > 1000). For smaller samples,'achr'
might be better suited.'achr'
which uses artificial centering hit-and-run via theConcACHRSampler
. This is a single process method with good convergence [KS98].
- Parameters
concentration_solver (ConcSolver) – The
ConcSolver
to use in generating samples.n (int) – The number of samples to obtain. When using
'method=optgp'
, this must be a multiple ofprocesses
, otherwise a larger number of samples will be returned.method (str) – The sampling algorithm to use. Default is
'optgp'
.thinning (int) –
The thinning factor for the generated sampling chain as a positive
int
> 0. A thinning factor of 10 means samples are returned every 10 steps. If set to one, all iterates are returned.Default is
100
.The number of processes used to generate samples. If
None
the number of processes specified in theMassConfiguration
is utilized. Only valid formethod='optgp'
.Default is
1
.A positive
int
> 0 indiciating random number seed that should be used. IfNone
provided, the current time stamp is used.Default is
None
.
- Returns
The generated concentration samples. Each row corresponds to a sample of the concentrations and the columns are the metabolites.
- Return type
See also
ConcSolver.setup_sampling_problem()
For setup of the sampling problem in the given
ConcSolver
.