# tfp.experimental.substrates.numpy.experimental.inference_gym.targets.Banana

Creates a banana-shaped distribution.

Inherits From: Model

This distribution was first described in [1]. The distribution is constructed by transforming a 2-D normal distribution with scale [10, 1] by shifting the second dimension by curvature * (x0**2 - 100) where x0 is the value of the first dimension. If an N > 2 dimensions are requested, the remaining dimensions are distributed as a standard normal.

This distribution is notable for having relatively narrow tails, while being derived from a simple, volume-preserving transformation of a normal distribution. Despite this simplicity, some inference algorithms have trouble sampling from this distribution.

#### References

1. Haario, H., Saksman, E., & Tamminen, J. (1999). Adaptive proposal distribution for random walk Metropolis algorithm. Computational Statistics, 14(3), 375-396.

ndims Python integer. Dimensionality of the distribution. Must be at least 2.
curvature Python float. Controls the strength of the curvature of the distribution.
name Python str name prefixed to Ops created by this class.
pretty_name A Python str. The pretty name of this model.

ValueError If ndims < 2.

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

### sample

View source

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.

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

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.