Skip to content

Commit

Permalink
Convert X to array in kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
vals committed Oct 31, 2020
1 parent a737813 commit 87b908b
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 0 deletions.
Binary file added Analysis/MouseOB/MOB_clusters.pdf
Binary file not shown.
Binary file added Analysis/MouseOB/MOB_significance_comparison.pdf
Binary file not shown.
Binary file added Analysis/MouseOB/PCA_MOB.pdf
Binary file not shown.
Binary file added Analysis/MouseOB/mob-gmm-weights.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions Python-module/SpatialDE/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_l_limits(X):
## Kernels ##

def SE_kernel(X, l):
X = np.array(X)
Xsq = np.sum(np.square(X), 1)
R2 = -2. * np.dot(X, X.T) + (Xsq[:, None] + Xsq[None, :])
R2 = np.clip(R2, 1e-12, np.inf)
Expand All @@ -52,6 +53,7 @@ def cosine_kernel(X, p):
Easier interpretable composability with SE?
'''
X = np.array(X)
Xsq = np.sum(np.square(X), 1)
R2 = -2. * np.dot(X, X.T) + (Xsq[:, None] + Xsq[None, :])
R2 = np.clip(R2, 1e-12, np.inf)
Expand Down

0 comments on commit 87b908b

Please sign in to comment.