def pairwise_kernels(X, Y=None, metric='linear', filter_params=False, n_jobs=1, **kwds):
 from ..gaussian_process.kernels import Kernel as GPKernel
 if (metric == 'precomputed'):
  (X, _) = check_pairwise_arrays(X, Y, precomputed=True)
  return X
 elif isinstance(metric, GPKernel):
  func = metric.__call__
 elif (metric in PAIRWISE_KERNEL_FUNCTIONS):
  if filter_params:
   kwds = dict(((k, kwds[k]) for k in kwds if (k in KERNEL_PARAMS[metric])))
  func = PAIRWISE_KERNEL_FUNCTIONS[metric]
 elif callable(metric):
  func = partial(_pairwise_callable, metric=metric, **kwds)
 else:
  raise ValueError(('Unknown kernel %r' % metric))
 return _parallel_pairwise(X, Y, func, n_jobs, **kwds)

def pairwise_kernels ( X , Y = None , metric = 'linear' , filter_params = False , n_jobs = 1 , ** kwds ) : from . . gaussian_process . kernels import Kernel as GPKernel if ( metric == 'precomputed' ) : ( X , _ ) = check_pairwise_arrays ( X , Y , precomputed = True ) return X elif isinstance ( metric , GPKernel ) : func = metric . __call__ elif ( metric in PAIRWISE_KERNEL_FUNCTIONS ) : if filter_params : kwds = dict ( ( ( k , kwds [ k ] ) for k in kwds if ( k in KERNEL_PARAMS [ metric ] ) ) ) func = PAIRWISE_KERNEL_FUNCTIONS [ metric ] elif callable ( metric ) : func = partial ( _pairwise_callable , metric = metric , ** kwds ) else : raise ValueError ( ( 'Unknown kernel %r' % metric ) ) return _parallel_pairwise ( X , Y , func , n_jobs , ** kwds )
compute the kernel between arrays x and optional array y .