sklearn.metrics.pairwise.additive_chi2_kernel — scikit-learn 0.20.4 documentation (original) (raw)

sklearn.metrics.pairwise. additive_chi2_kernel(X, Y=None)[source]

Computes the additive chi-squared kernel between observations in X and Y

The chi-squared kernel is computed between each pair of rows in X and Y. X and Y have to be non-negative. This kernel is most commonly applied to histograms.

The chi-squared kernel is given by:

k(x, y) = -Sum [(x - y)^2 / (x + y)]

It can be interpreted as a weighted difference per entry.

Read more in the User Guide.

Parameters: X : array-like of shape (n_samples_X, n_features) Y : array of shape (n_samples_Y, n_features)
Returns: kernel_matrix : array of shape (n_samples_X, n_samples_Y)

Notes

As the negative of a distance, this kernel is only conditionally positive definite.

References