code: def additive_chi2_kernel(X, Y=None):
      """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 :ref:`User Guide <chi2_kernel>`.
  
      Notes
      -----
      As the negative of a distance, this kernel is only conditionally positive
      definite.
  
  
      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)
  
      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
      --------
      chi2_kernel : The exponentiated version of the kernel, which is usually
          preferable.
  
      sklearn.kernel_approximation.AdditiveChi2Sampler : A Fourier approximation
          to this kernel.
      """
      if issparse(X) or issparse(Y):
          raise ValueError(
              "additive_chi2 does not support sparse matrices."
          )
      X, Y = check_pairwise_arrays(X, Y)
      if (X < 0).any():
          raise ValueError("X contains negative values.")
      if Y is not X and (Y < 0).any():
          raise ValueError("Y contains negative values.")
  
      result = np.zeros((X.shape[0], Y.shape[0]), dtype=X.dtype)
      _chi2_kernel_fast(X, Y, result)
      return result
  
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 19 for calling a global function with example usage: additive_chi2_kernel(X, Y) and returns: result