summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-02-29 11:31:40 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-02-29 11:31:40 -0700
commit9e90b73721edf370f7be9c77aba8431bbe762bdb (patch)
tree899c9e625e2a4e90c76a99f032e98fae725c80cf
parent1384a40fb90f9118410d5473634ddbff8b628841 (diff)
float to np float)
-rw-r--r--ml_exp/kernels.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/ml_exp/kernels.py b/ml_exp/kernels.py
index e6855f97e..feaf9a990 100644
--- a/ml_exp/kernels.py
+++ b/ml_exp/kernels.py
@@ -37,9 +37,9 @@ def gaussian_kernel(X1,
"""
i_sigma = -0.5 / (sigma*sigma)
- K = np.zeros((X1.shape[0], X2.shape[0]), dtype=float)
+ K = np.zeros((X1.shape[0], X2.shape[0]), dtype=np.float64)
if opt:
- # Faster way of calculating the kernel.
+ # Faster way of calculating the kernel (no numba support).
for i, x1 in enumerate(X1):
if X2.ndim == 3:
norm = np.linalg.norm(X2 - x1, axis=(1, 2))
@@ -50,7 +50,6 @@ def gaussian_kernel(X1,
for i, x1 in enumerate(X1):
for j, x2 in enumerate(X2):
f_norm = np.linalg.norm(x2 - x1)
- # print(f_norm)
K[i, j] = math.exp(i_sigma * f_norm**2)
return K