queens.parameters package#

Parameters.

Modules grouping deterministic and continuous random variables or random fields.

Subpackages#

Submodules#

queens.parameters.parameters module#

Parameters.

class Parameters(**parameters)[source]#

Bases: object

Parameters class.

dict#

Random variables and random fields stored in a dict.

Type:

dict

parameters_keys#

List of keys for all parameter members.

Type:

list

num_parameters#

Number of (truncated) parameters.

Type:

int

random_field_flag#

Specifies if random fields are used.

Type:

bool

names#

Parameter names.

Type:

list

draw_samples(num_samples)[source]#

Draw samples from all parameters.

Parameters:

num_samples (int) – The number of samples to draw for each parameter.

Returns:

samples (np.ndarray) – Drawn samples

expand_random_field_realization(truncated_sample)[source]#

Expand truncated representation of random fields.

Parameters:

truncated_sample (np.ndarray) – Truncated representation of sample

Returns:

sample_expanded (np.ndarray) – Expanded representation of sample

grad_joint_logpdf(samples)[source]#

Evaluate the gradient of the joint logpdf w.r.t. the samples.

Parameters:

samples (np.ndarray) – Samples for which to evaluate the gradient of the joint logpdf. Each row represents a sample and each column corresponds to a parameter dimension.

Returns:

grad_logpdf (np.ndarray) – Gradient of the joint logpdf w.r.t. the samples

inverse_cdf_transform(samples)[source]#

Transform samples to unit interval.

Parameters:

samples (np.ndarray) – Samples that should be transformed.

Returns:

transformed_samples (np.ndarray) – Transformed samples

joint_logpdf(samples)[source]#

Evaluate the logpdf summed over all parameters.

Parameters:

samples (np.ndarray) – Samples for which to evaluate the joint logpdf. Each row represents a sample and each column corresponds to a parameter dimension.

Returns:

logpdf (np.ndarray) – logpdf summed over all parameters

latent_grad(upstream_gradient)[source]#

Gradient of the rvs and rfs w.r.t. latent variables.

Parameters:

upstream_gradient (np.array) – Upstream gradient

Returns:

gradient (np.ndarray) – Gradient of the joint rvs/rfs w.r.t. the samples

sample_as_dict(sample)[source]#

Return sample as a dict.

Parameters:

sample (np.ndarray) – A single sample

Returns:
  • sample_dict (dict) – Dictionary containing sample members and the corresponding parameter

  • keys

to_distribution_list()[source]#

Return the distributions of the parameters as list.

Returns:

distribution_list (list) – List of distributions of parameters

to_list()[source]#

Return parameters as list.

Returns:

parameter_list (list) – List of parameters

from_config_create_parameters(parameters_options, pre_processor=None)[source]#

Create a QUEENS parameter object from config.

Parameters:
  • parameters_options (dict) – Parameters description

  • pre_processor (obj, optional) – Pre-processor object to read coordinates of random field discretization