code: def chi2_kernel(X, Y=None, gamma=1.0):
      """Computes the exponential chi-squared kernel 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) = exp(-gamma Sum [(x - y)^2 / (x + y)])
  
      It can be interpreted as a weighted difference per entry.
  
      Read more in the :ref:`User Guide <chi2_kernel>`.
  
      Parameters
      ----------
      X : array-like of shape (n_samples_X, n_features)
  
      Y : array of shape (n_samples_Y, n_features)
  
      gamma : float, default=1.
          Scaling parameter of the chi2 kernel.
  
      Returns
      -------
      kernel_matrix : array of shape (n_samples_X, n_samples_Y)
  
      References
      ----------
      * Zhang, J. and Marszalek, M. and Lazebnik, S. and Schmid, C.
        Local features and kernels for classification of texture and object
        categories: A comprehensive study
        International Journal of Computer Vision 2007
        http://research.microsoft.com/en-us/um/people/manik/projects/trade-off/papers/ZhangIJCV06.pdf
  
      See also
      --------
      additive_chi2_kernel : The additive version of this kernel
  
      sklearn.kernel_approximation.AdditiveChi2Sampler : A Fourier approximation
          to the additive version of this kernel.
      """
      K = additive_chi2_kernel(X, Y)
      K *= gamma
      return np.exp(K, K)
  
imports: import itertools
  import numpy
  from scipy.spatial import distance
  from scipy.sparse import csr_matrix
  from scipy.sparse import issparse
  from ..utils import check_array
  from ..utils import gen_even_slices
  from ..utils import gen_batches
  from ..utils.fixes import partial
  from ..utils.extmath import row_norms, safe_sparse_dot
  from ..preprocessing import normalize
  from ..externals.joblib import Parallel
  from ..externals.joblib import delayed
  from ..externals.joblib import cpu_count
  from .pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
label_desc: Use image node_id 20 for calling a global function with example usage: chi2_kernel(X, Y, gamma) and returns: np