Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfp.experimental.substrates.numpy.experimental.inference_gym.targets.IllConditionedGaussian

View source on GitHub

Creates a random ill-conditioned Gaussian.

Inherits From: BayesianModel

tfp.experimental.substrates.numpy.experimental.inference_gym.targets.IllConditionedGaussian(
    ndims=100, gamma_shape_parameter=0.5, max_eigvalue=None, seed=10,
    name='ill_conditioned_gaussian', pretty_name='Ill-Conditioned Gaussian'
)

The covariance matrix has eigenvalues sampled from the inverse Gamma distribution with the specified shape, and then rotated by a random orthogonal matrix.

Note that this function produces reproducible targets, i.e. the constructor seed argument always needs to be non-None.

Args:

  • ndims: Python int. Dimensionality of the Gaussian.
  • gamma_shape_parameter: Python float. The shape parameter of the inverse Gamma distribution. Anything below 2 is likely to yield poorly conditioned covariance matrices.
  • max_eigvalue: Python float. If set, will normalize the eigenvalues such that the maximum is this value.
  • seed: Seed to use when generating the eigenvalues and the random orthogonal matrix.
  • name: Python str name prefixed to Ops created by this class.
  • pretty_name: A Python str. The pretty name of this model.

Attributes:

  • covariance_eigenvalues
  • default_event_space_bijector: Bijector mapping the reals (R**n) to the event space of this model.
  • dtype: The DType of Tensors handled by this model.
  • event_shape: Shape of a single sample from as a TensorShape.

    May be partially defined or unknown.

  • name: Python str name prefixed to Ops created by this class.

  • sample_transformations: A dictionary of names to SampleTransformations.

Child Classes

class SampleTransformation

Methods

evidence

View source

evidence(
    name='evidence'
)

The evidence that the joint model is conditioned on.

joint_distribution

View source

joint_distribution(
    name='joint_distribution'
)

The joint distribution before any conditioning.

sample

View source

sample(
    sample_shape=(), seed=None, name='sample'
)

Generate samples of the specified shape from the target distribution.

The returned samples are exact (and independent) samples from the target distribution of this model.

Note that a call to sample() without arguments will generate a single sample.

Args:

  • sample_shape: 0D or 1D int32 Tensor. Shape of the generated samples.
  • seed: Python integer or tfp.util.SeedStream instance, for seeding PRNG.
  • name: Name to give to the prefix the generated ops.

Returns:

  • samples: a Tensor with prepended dimensions sample_shape.

unnormalized_log_prob

View source

unnormalized_log_prob(
    value, name='unnormalized_log_prob'
)

The un-normalized log density of evaluated at a point.

This corresponds to the target distribution associated with the model, often its posterior.

Args:

  • value: A (nest of) Tensor to evaluate the log density at.
  • name: Python str name prefixed to Ops created by this method.

Returns:

  • unnormalized_log_prob: A floating point Tensor.