This documentation is for scikit-learn version 0.11-gitOther versions

Citing

If you use the software, please consider citing scikit-learn.

This page

8.16.4.5. sklearn.metrics.pairwise.rbf_kernel

sklearn.metrics.pairwise.rbf_kernel(X, Y=None, gamma=0)

Compute the rbf (gaussian) kernel between X and Y:

K(X, Y) = exp(-gamma ||X-Y||^2)
Parameters :

X : array of shape (n_samples_1, n_features)

Y : array of shape (n_samples_2, n_features)

gamma : float

Returns :

Gram matrix : array of shape (n_samples_1, n_samples_2)