altar.cuda.data.cudaDataL2

Module Contents

Classes

class altar.cuda.data.cudaDataL2.cudaDataL2(name, locator, **kwds)

Bases: altar.data.DataL2.DataL2

The observed data with L2 norm

data_file
doc = the name of the file with the observations
observations
doc = the number of observed data
cd_file
doc = the name of the file with the data covariance matrix
cd_std
doc = the constant covariance for data, sigma^2
dtype_cd
doc = the data type (float32/64) for Cd computations if different from others
norm
default
doc = l2 norm for calculating likelihood
merge_cd_to_data = True
normalization = 0
precision
gdataObsBatch
gcd_inv
initialize(self, application)

Initialize data obs from model

cuEvalLikelihood(self, prediction, likelihood, residual=True, batch=None)

compute the datalikelihood for prediction :param prediction: (samples x observations) input of predicted data :param likelihood: (samples) pre-allocated likelihood/norm :param residual: whether prediction is already subtracted by observed data :param batch: number of (first few) samples to be computed :return: likelihood

release_cd(self)

release gcd_inv

loadFile(self, filename, shape, 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

  1. (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

initializeCovariance(self)

initialize gpu data and data covariance

updateCovariance(self, cp=None)

Update the data covariance C_chi = Cd + Cp :param cp: cuda matrix with shape(obs, obs), data covariance due to model uncertainty :return:

checkPositiveDefiniteness(self, matrix, name=None)

Check positive definiteness of a GPU matrix :param matrix: a real symmetric (GPU) matrix :return: true or false

mergeCdtoData(self, cd_inv, data)

Merge the data covariance matrix to observed data :param cd_inv: the inverse of covariance matrix in Cholesky-decomposed form, with Lower matrix filled :param data: raw observed data :return: cd_inv*data, a cuda vector