Browse Source

[Fix] Fixed the bug that gklearn.utils.kernels.gaussiankernel can not handle lists as inputs.

v0.2.x
jajupmochi 4 years ago
parent
commit
4fd314d374
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      gklearn/utils/kernels.py

+ 2
- 1
gklearn/utils/kernels.py View File

@@ -3,6 +3,7 @@ These kernels are defined between pairs of vectors.
"""
import numpy as np


def deltakernel(x, y):
"""Delta kernel. Return 1 if x == y, 0 otherwise.

@@ -56,7 +57,7 @@ def gaussiankernel(x, y, gamma=None):
# kernel = np.exp(kernel)
# return kernel

return np.exp((np.sum((x - y) ** 2)) * -gamma)
return np.exp((np.sum(np.subtract(x, y) ** 2)) * -gamma)





Loading…
Cancel
Save