ed.rbf

Aliases:

  • ed.rbf
  • ed.util.rbf
rbf(
    X,
    X2=None,
    lengthscale=1.0,
    variance=1.0
)

Defined in edward/util/tensorflow.py.

Radial basis function kernel, also known as the squared exponential or exponentiated quadratic. It is defined as

\(k(x, x') = \sigma^2 \exp\Big( -\frac{1}{2} \sum_{d=1}^D \frac{1}{\ell_d^2} (x_d - x'_d)^2 \Big)\)

for output variance \(\sigma^2\) and lengthscale \(\ell^2\).

The kernel is evaluated over all pairs of rows, k(X[i, ], X2[j, ]). If X2 is not specified, then it evaluates over all pairs of rows in X, k(X[i, ], X[j, ]). The output is a matrix where each entry (i, j) is the kernel over the ith and jth rows.

Args:

  • X: tf.Tensor. N x D matrix of N data points each with D features.
  • X2: tf.Tensor. N x D matrix of N data points each with D features.
  • lengthscale: tf.Tensor. Lengthscale parameter, a positive scalar or D-dimensional vector.
  • variance: tf.Tensor. Output variance parameter, a positive scalar.

Examples

X = tf.random_normal([100, 5])
K = ed.rbf(X)
assert K.shape == (100, 100)