altar.cuda.models.cudaBayesianEnsemble
Module Contents
Classes
- class altar.cuda.models.cudaBayesianEnsemble.cudaBayesianEnsemble(name, locator, **kwds)
Bases:
altar.models.Bayesian.BayesianA collection of AlTar models that comprise a single model
- models
- doc = the collection of models in this ensemble
- parameters
- doc = the number of model degrees of freedom
- psets_list
- doc = list of parameter sets, used to set orders
- psets
- doc = an ensemble of parameter sets in the model
- case
- doc = the directory with the input files
- forwardonly
- doc = whether to run the simulation or the forward problem only
- theta_input
- doc = the theta input file with a vector of parameters
- theta_dataset
- doc = the name/path of the theta dataset in h5 file
- forward_output
- doc = the name/path of the file to save forward problem results
- datallk
- initialize(self, application)
Initialize the state of the model given an {application} context
- cuInitialize(self, application)
cuda initialization
- posterior(self, application)
Sample my posterior distribution
- cuInitSample(self, theta)
Fill {theta} with an initial random sample from my prior distribution.
- cuVerify(self, theta, mask)
Check whether the samples in {step.theta} are consistent with the model requirements and update the {mask}, a vector with zeroes for valid samples and non-zero for invalid ones
- cuEvalPrior(self, theta, prior, batch)
Fill {priorLLK} with the log likelihoods of the samples in {theta} in my prior distribution
- cuEvalLikelihood(self, step, batch)
Fill {step.data} with the likelihoods of the samples in {step.theta} given the available data. This is what is usually referred to as the “forward model”
- cuEvalPosterior(self, step, batch)
Given the {step.prior} and {step.data} likelihoods, compute a generalized posterior using {step.beta} and deposit the result in {step.post}
- updateModel(self, annealer)
Update model parameters if needed :param annealer: :return:
- likelihoods(self, annealer, step, batch)
Convenience function that computes all three likelihoods at once given the current {step} of the problem
- verify(self, step, mask)
Check whether the samples in {step.theta} are consistent with the model requirements and update the {mask}, a vector with zeroes for valid samples and non-zero for invalid ones
- mountInputDataspace(self, pfs)
Mount the directory with my input files
- loadFile(self, filename, shape=None, dataset=None, dtype=None)
Load an input file to a numpy array (for both float32/64 support) Supported format: 1. text file in ‘.txt’ suffix, stored in prescribed shape 2. binary file with ‘.bin’ or ‘.dat’ suffix,
the precision must be same as the desired gpuprecision, and users must specify the shape of the data
- (preferred) hdf5 file in ‘.h5’ suffix (preferred)
the metadata of shape, precision is included in .h5 file
- Parameters:
filename – str, the input file name
shape – list of int
dataset – str, name/key of dataset for h5 input only
- Returns:
output numpy.array
- loadFileToGPU(self, filename, shape=None, dataset=None, out=None, dtype=None)
Load an input file to a gpu (for both float32/64 support) Supported format: 1. text file in ‘.txt’ suffix, stored in prescribed shape 2. binary file with ‘.bin’ or ‘.dat’ suffix,
the precision must be same as the desired gpuprecision, and users must specify the shape of the data
- (preferred) hdf5 file in ‘.h5’ suffix (preferred)
the metadata of shape, precision is included in .h5 file
- Parameters:
filename – str, the input file name
shape – list of int
dataset – str, name/key of dataset for h5 input only
- Returns:
out altar.cuda.matrix/vector
- forwardProblem(self, application, theta=None)
Perform the forward modeling with given {theta}