Skip to content

Commit

Permalink
Changes epsilon in S-Curve example
Browse files Browse the repository at this point in the history
  • Loading branch information
dimtsap committed Apr 6, 2022
1 parent 7d92c14 commit 7ae39e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# %% md
#
# Case 1: Find the optimal parameter of the Gaussian kernel scale epsilon
kernel = GaussianKernel()
kernel = GaussianKernel(epsilon=0.0018332392635542376)

dmaps_object = DiffusionMaps(data=X,
alpha=1.0, n_eigenvectors=9,
Expand Down
8 changes: 4 additions & 4 deletions src/UQpy/utilities/kernels/GaussianKernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def kernel_entry(self, xi: Numpy2DFloatArray, xj: Numpy2DFloatArray):
:return: Float representing the kernel entry.
"""
if len(xi.shape) == 1:
d = pdist([xi, xj], "sqeuclidean")
d = pdist(np.array([xi, xj]), "sqeuclidean")
else:
d = np.linalg.norm(xi-xj, 'fro')
return np.exp(-d ** 2 / (4*self.epsilon))
d = np.linalg.norm(xi-xj, 'fro') ** 2
return np.exp(-d / (4*self.epsilon))

def optimize_parameters(self, data: np.ndarray, tolerance: float,
n_nearest_neighbors: int,
n_cutoff_samples: int,
random_state: RandomStateType):
random_state: RandomStateType = None):
"""
:param data: Set of data points.
Expand Down

0 comments on commit 7ae39e8

Please sign in to comment.