-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from SURGroup/feature/unify_kernels
unify kernels
- Loading branch information
Showing
28 changed files
with
265 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/UQpy/dimension_reduction/grassmann_manifold/projections/baseclass/GrassmannProjection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from UQpy.surrogates.gaussian_process.GaussianProcessRegression import GaussianProcessRegression | ||
|
||
from UQpy.surrogates.gaussian_process.kernels import * | ||
from UQpy.surrogates.gaussian_process.regression_models import * | ||
from UQpy.surrogates.gaussian_process.constraints import * |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
src/UQpy/surrogates/gaussian_process/kernels/baseclass/Kernel.py
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/UQpy/surrogates/gaussian_process/kernels/baseclass/__init__.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from UQpy.utilities.kernels.baseclass import * | ||
from UQpy.utilities.kernels.euclidean_kernels import * | ||
from UQpy.utilities.kernels.grassmannian_kernels import * | ||
|
||
from UQpy.utilities.kernels.BinetCauchyKernel import BinetCauchyKernel | ||
from UQpy.utilities.kernels.grassmannian_kernels.BinetCauchyKernel import BinetCauchyKernel | ||
from UQpy.utilities.kernels.GaussianKernel import GaussianKernel | ||
from UQpy.utilities.kernels.ProjectionKernel import ProjectionKernel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,7 @@ | ||
import itertools | ||
from abc import ABC, abstractmethod | ||
from typing import Union | ||
import scipy.spatial.distance as sd | ||
import numpy as np | ||
from abc import ABC | ||
|
||
from UQpy.utilities import GrassmannPoint | ||
from UQpy.utilities.ValidationTypes import NumpyFloatArray, Numpy2DFloatArray | ||
from UQpy.utilities.kernels.baseclass.Kernel import Kernel | ||
|
||
|
||
class EuclideanKernel(Kernel, ABC): | ||
"""This is a blueprint for Euclidean kernels implemented in the :py:mod:`kernels` module .""" | ||
|
||
def __init__(self): | ||
super().__init__() | ||
|
||
def calculate_kernel_matrix(self, points: Numpy2DFloatArray): | ||
""" | ||
Using the kernel-specific :py:meth:`.Kernel.kernel_entry` method, this function assembles the kernel matrix. | ||
:param points: Set of data points in the Euclidean space | ||
""" | ||
nargs = len(points) | ||
indices = range(nargs) | ||
pairs = list(itertools.combinations_with_replacement(indices, 2)) | ||
kernel = np.zeros((nargs, nargs)) | ||
for id_pair in range(np.shape(pairs)[0]): | ||
i = pairs[id_pair][0] | ||
j = pairs[id_pair][1] | ||
|
||
xi = points[i] | ||
xj = points[j] | ||
|
||
kernel[i, j] = self.kernel_entry(xi, xj) | ||
kernel[j, i] = kernel[i, j] | ||
|
||
self.kernel_matrix = kernel |
Oops, something went wrong.