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

tfp.experimental.substrates.jax.experimental.inference_gym.targets.BayesianModel.SampleTransformation

View source on GitHub

A transformation of samples of the outer BayesianModel.

@staticmethod
tfp.experimental.substrates.jax.experimental.inference_gym.targets.BayesianModel.SampleTransformation(
    _cls, fn, pretty_name, ground_truth_mean=None,
    ground_truth_mean_standard_error=None, ground_truth_standard_deviation=None,
    ground_truth_standard_deviation_standard_error=None
)

Specifically, E_{x~p}[f(x)] for a model p and transformation f. The model p is implicit, in that the SampleTransformation appears in the sample_transformations field of that BayesianModel. The f is given as fn so that candidate samples may be passed through it. The fn may close over the parameters of p, and the ground_truth_mean will presumably depend on p implicitly via some sampling process.

If the ground_truth_mean is estimated by sampling, then ground_truth_standard_deviation and ground_truth_mean_standard_error are related using the standard formula:

SEM = SD / sqrt(N)

where N is the number of samples. ground_truth_standard_deviation describes the distribution of f(x), while ground_truth_mean_standard_error desribes how accurately we know ground_truth_mean.

Attributes:

  • fn: Function that takes samples from the target and returns a (nest of) Tensor. The returned Tensor must retain the leading non-event dimensions.
  • pretty_name: Human readable name, suitable for a table in a paper.
  • ground_truth_mean: Ground truth value of this expectation. Can be None if not available. Default: None.
  • ground_truth_mean_standard_error: Standard error of the ground truth mean. Can be None if not available. Default: None.
  • ground_truth_standard_deviation: Standard deviation of samples transformed by fn. Can be None if not available. Default: None.
  • ground_truth_standard_deviation_standard_error: Standard error of the ground truth standard deviation. Can be None if not available. Default: None.

Examples

An identity fn for a vector-valued target would look like:

fn = lambda x: x

Methods

__call__

View source

__call__(
    value
)

Returns fn(value).