8000 DOC pretty math in kernel docstrings · deepatdotnet/scikit-learn@34ef825 · GitHub
[go: up one dir, main page]

Skip to content

Commit 34ef825

Browse files
committed
DOC pretty math in kernel docstrings
Thank you unicodeit.net!
1 parent 0757503 commit 34ef825

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sklearn/metrics/pairwise.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""
23
The :mod:`sklearn.metrics.pairwise` submodule implements utilities to evaluate
34
pairwise distances or affinity of sets of samples.
@@ -322,7 +323,7 @@ def rbf_kernel(X, Y=None, gamma=None):
322323
"""
323324
Compute the rbf (gaussian) kernel between X and Y::
324325
325-
K(x, y) = exp(-gamma ||x-y||^2)
326+
K(x, y) = exp(-γ ||x-y||²)
326327
327328
for each pair of rows x in X and y in Y.
328329
@@ -395,7 +396,7 @@ def additive_chi2_kernel(X, Y=None):
395396
396397
The chi-squared kernel is given by::
397398
398-
k(x, y) = -\sum_i (x[i] - y[i]) ** 2 / (x[i] + y[i])
399+
k(x, y) = -∑ᵢ [(xᵢ - yᵢ)² / (xᵢ + yᵢ)]
399400
400401
It can be interpreted as a weighted difference per entry.
401402
@@ -477,7 +478,7 @@ def chi2_kernel(X, Y=None, gamma=1.):
477478
478479
The chi-squared kernel is given by::
479480
480-
k(x, y) = exp(-gamma * \sum_i (x[i] - y[i]) ** 2 / (x[i] + y[i]))
481+
k(x, y) = exp(-γ ∑ᵢ [(xᵢ - yᵢ)² / (xᵢ + yᵢ)])
481482
482483
It can be interpreted as a weighted difference per entry.
483484

0 commit comments

Comments
 (0)
0