Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Li <adam2392@gmail.com>
  • Loading branch information
adam2392 committed Aug 16, 2023
1 parent b634c63 commit f6ce858
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pywhy_stats/kernel_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ def compute_kernel(
-------
kernel : ArrayLike of shape (n_samples_X, n_samples_X) or (n_samples_X, n_samples_Y)
The kernel matrix.
Notes
-----
If the metric is a callable, it will have either one input for ``X``, or two inputs for ``X`` and
``Y``. If one input is passed in, it is assumed that the kernel operates on the entire array to compute
the kernel array. If two inputs are passed in, then it is assumed that the kernel operates on
pairwise row vectors from each input array. This callable is parallelized across rows of the input
using :func:`~sklearn.metrics.pairwise.pairwise_kernels`. Note that ``(X, Y=None)`` is a valid input
signature for the kernel function and would then get passed to the pairwise kernel function. If
a callable is passed in, it is generally faster and more efficient if one can define a vectorized
operation that operates on the whole array at once. Otherwise, the pairwise kernel function will
call the function for each combination of rows in the input arrays.
"""
# if the width of the kernel is not set, then use the median trick to set the
# kernel width based on the data X
Expand Down

0 comments on commit f6ce858

Please sign in to comment.