compute_kern¶
- hyppo.tools.compute_kern(x, y, metric='gaussian', workers=1, **kwargs)¶
- Kernel similarity matrices for the inputs. - Parameters
- x,y ( - ndarrayof- float) -- Input data matrices.- xand- ymust have the same number of samples. That is, the shapes must be- (n, p)and- (n, q)where n is the number of samples and p and q are the number of dimensions. Alternatively,- xand- ycan be kernel similarity matrices, where the shapes must both be- (n, n).
- metric ( - str,- callable, or- None, default:- "gaussian") -- A function that computes the kernel similarity among the samples within each data matrix. Valid strings for- metricare, as defined in- sklearn.metrics.pairwise.pairwise_kernels,- [ - "additive_chi2",- "chi2",- "linear",- "poly",- "polynomial",- "rbf",- "laplacian",- "sigmoid",- "cosine"]- Note - "rbf"and- "gaussian"are the same metric. Set to- Noneor- "precomputed"if- xand- yare already similarity matrices. To call a custom function, either create the similarity matrix before-hand or create a function of the form- metric(x, **kwargs)where- xis the data matrix for which pairwise kernel similarity matrices are calculated and kwargs are extra arguements to send to your custom function.
- workers ( - int, default:- 1) -- The number of cores to parallelize the p-value computation over. Supply- -1to use all cores available to the Process.
- **kwargs -- Arbitrary keyword arguments provided to - sklearn.metrics.pairwise.pairwise_kernelsor a custom kernel function.
 
- Returns
- simx, simy ( - ndarrayof- float) -- Similarity matrices based on the metric provided by the user.