linna.main
Module Contents
Functions
|
LINNA main function with hyperparameters set to values described in To et al. 2022 |
|
LINNA main function |
- linna.main.ml_sampler(outdir, theory, priors, data, cov, init, pool, nwalkers, gpunode, omegab2cut=None, nepoch=4500, method='zeus', nbest=None, chisqcut=None, loglikelihoodfunc=None)[source]
LINNA main function with hyperparameters set to values described in To et al. 2022
- Parameters
outdir (string) – output directory
theory (function) – theory model
str (priors (dict of) – [float, float]): string can be either flat or gauss. If the string is ‘flat’, [a,b] indicates the lower and upper limits of the prior. If the string is ‘gauss’, [a,b] indicates the mean and sigma.
data (1d array) – float array, data vector
cov (2d array) – float array, covariance matrix
init (ndarray) – initial guess of mcmc,
pool (mpi pool, optional) – a mpi pool instance that can do pool.map(function, iterables).
nwalkers (int) –
gpunode (string) – name of gpu node
omegab2cut (list of int) – 2 elements containing the lower and upper limits of omegab*h^2
nepoch (int, optional) – maximum number of epoch for the neural network training
method (string, optional) – Samplers. LINNA supports emcee and `zeus`(default)
nbest (int or list of int) – number of points to include in the training set per iteration according to the optimizer
chisqcut (float, optional) – cut the training data if there chisq is greater than this value
loglikelihoodfunc (callable, optional) – function of model, data , inverse of covariance matrix and return the log liklihood value. If None, then use gaussian likelihood
- Returns
MCMC chain 1d array: log probability of MCMC chain
- Return type
nd array
- linna.main.ml_sampler_core(ntrainArr, nvalArr, nkeepArr, ntimesArr, ntautolArr, meanshiftArr, stdshiftArr, outdir, theory, priors, data, cov, init, pool, nwalkers, device, dolog10index, ypositive, temperatureArr, omegab2cut=None, docuda=False, tsize=1, gpunode=None, nnmodel_in=None, params=None, method='emcee', nbest=None, chisqcut=None, loglikelihoodfunc=None, nsigma=3)[source]
LINNA main function
- Parameters
ntrainArr (int array) – number of training data per iteration
nvalArr (int array) – number of validation data per iteration
nkeepArr (int array) – number of autocorrelation time to be kept
ntimesArr (int array) – number of autocorrelation time to stop mcmc
ntautolArr (float array) – error limit of autocorrelation time
meanshiftArr (float array) – limit on mean shift of parameter estimation from the first and second half of the chain
stdshiftArr (float array) – limit on std shift of parameter estimation from the first and second half of the chain
outdir (string) – output directory
theory (function) – theory model
str (priors (dict of) – [float, float]): string can be either flat or gauss. If the string is ‘flat’, [a,b] indicates the lower and upper limits of the prior. If the string is ‘gauss’, [a,b] indicates the mean and sigma.
data (1d array) – float array, data vector
cov (2d array) – float array, covariance matrix
init (ndarray) – initial guess of mcmc,
pool (object) – mpi4py pool instance
nwalkers (int) –
device (string) – cpu or gpu
dolog10index (int array) – index of parameters to do log10
ypositive (bool) – whether the data vector is expected to be all positive
temperatureArr (float array) – temperature parameters for each iteration
omegab2cut (list of int) – 2 elements containing the lower and upper limits of omegab*h^2
docuda (bool) – whether do gpu for evaluation
tsize (int, optional) – number of cores for training
gpunode (string) – name of gpu node
nnmodel_in (string) – instance of neural network model
params (dictionary) – dictionary of parameters
method (string) – sampling method
nbest (int or list of int) – number of points to include in the training set per iteration according to the optimizer
chisqcut (float, optional) – cut the training data if there chisq is greater than this value
loglikelihoodfunc (callable) – function of model, data , inverse of covariance matrix and return the log liklihood value
nsigma (float) – the training point in the first iteration will be generated within nsigma of the gaussian prior
- Returns
MCMC chain 1d array: log probability of MCMC chain
- Return type
nd array