Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
229e2c4
Initial commit
imbirik Feb 12, 2025
5b8edb7
Work_to_home
iskaazn Feb 12, 2025
6b30bb6
Filtration of characters
imbirik Feb 13, 2025
8e48e94
Commit
imbirik Feb 24, 2025
c7d036e
fix of normalization
iskaazn Feb 24, 2025
25fe2bf
fix of projected dimensions computations
imbirik Mar 11, 2025
c3c7fd8
alternative_addition_theorem
imbirik Mar 12, 2025
9427e9f
commit
iskaazn Mar 21, 2025
ba7aa87
clean
imbirik Apr 3, 2025
27e4547
work in progress
iskaazn Apr 4, 2025
3435a88
fix of stiefel embedding
iskaazn Apr 9, 2025
594fe59
impelement grassmannian via jack polynomials
iskaazn May 25, 2025
066ea88
fix so2 sampling
iskaazn May 26, 2025
d88af5b
update zsf saving into json
iskaazn May 26, 2025
f20e0b8
fix signature filtration
iskaazn May 26, 2025
44396ab
implement grassmannian
iskaazn May 28, 2025
97da130
stiefel
imbirik May 29, 2025
d7f1fd2
grassmannian notebook
iskaazn May 29, 2025
6bac3d4
clean up
iskaazn May 29, 2025
c684d5e
clean up
iskaazn May 30, 2025
7dda93f
changes
imbirik Oct 5, 2025
97ca0d7
grassmanian testing
iskaazn Oct 22, 2025
c53cedc
stiefel test
iskaazn Oct 31, 2025
4fad615
lint
iskaazn Nov 2, 2025
4e1aad8
lint
iskaazn Nov 2, 2025
de577ba
lint
iskaazn Nov 2, 2025
478a57e
lint
iskaazn Nov 2, 2025
c131ee8
lint
iskaazn Nov 2, 2025
a79fae8
fix mypy
iskaazn Nov 2, 2025
c1c244a
fix helper
iskaazn Nov 2, 2025
bc06693
lint
iskaazn Nov 2, 2025
ed8c0e8
fix grassmanian torus_repr
iskaazn Nov 3, 2025
0897a43
fix import
iskaazn Nov 3, 2025
e6e60bf
test fix
iskaazn Nov 3, 2025
e48dbf6
lint
iskaazn Nov 3, 2025
bb3a9a2
lint
iskaazn Nov 3, 2025
bb94d5a
mypy fix
iskaazn Nov 3, 2025
7e13672
fix stiefel
iskaazn Nov 3, 2025
ff70856
reshape fix
iskaazn Nov 3, 2025
80187a2
lint
iskaazn Nov 3, 2025
66309d5
reshape
iskaazn Nov 3, 2025
fe55f83
lint
iskaazn Nov 3, 2025
e2e8a7c
test homogeneousspaces feature map kernels
iskaazn Nov 3, 2025
82491af
lint
iskaazn Nov 3, 2025
d2c9400
lint
iskaazn Nov 3, 2025
3adbab9
key
iskaazn Nov 4, 2025
2df79cc
lint
iskaazn Nov 4, 2025
d717a0b
delete tensorflow
iskaazn Nov 9, 2025
c340ae3
change default num features
iskaazn Nov 9, 2025
ba22f24
filter spaces
iskaazn Nov 9, 2025
a40157c
lint
iskaazn Nov 9, 2025
7cb9b38
lint
iskaazn Nov 9, 2025
9c28d69
llint
iskaazn Nov 9, 2025
da32aff
fix lint
iskaazn Nov 9, 2025
b9fefa4
lint
iskaazn Nov 9, 2025
cc98e61
fix
iskaazn Nov 16, 2025
5a78918
fix dtype
iskaazn Nov 16, 2025
da2915e
update nu
iskaazn Nov 16, 2025
d1b5d93
return tensorflow
iskaazn Nov 16, 2025
810748b
lint
iskaazn Nov 17, 2025
99d3407
relax test
imbirik Nov 17, 2025
59a123a
fix
imbirik Nov 18, 2025
98e1366
move to backend
imbirik Nov 18, 2025
2eb2739
stiefel fix
imbirik Nov 18, 2025
8258a40
fix shapes
imbirik Nov 19, 2025
a39b71c
increase constants for stiefel
imbirik Nov 19, 2025
fb28050
strange torch behaviour
imbirik Nov 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@ dmypy.json

# Idea
/.idea/
.vscode/launch.json
5 changes: 5 additions & 0 deletions geometric_kernels/kernels/feature_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def __init__(
self.feature_map = make_deterministic(feature_map, key)
self.normalize = normalize

if "eigenfunctions" in vars(feature_map):
self.eigenfunctions = feature_map.eigenfunctions # type: ignore[attr-defined]
else:
self.eigenfunctions = None

def init_params(self) -> Dict[str, B.NPNumeric]:
"""
Initializes the dict of the trainable parameters of the kernel.
Expand Down
48 changes: 37 additions & 11 deletions geometric_kernels/kernels/matern_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
from geometric_kernels.kernels.hodge_compositional import MaternHodgeCompositionalKernel
from geometric_kernels.kernels.karhunen_loeve import MaternKarhunenLoeveKernel
from geometric_kernels.spaces import (
CompactHomogeneousSpace,
CompactMatrixLieGroup,
DiscreteSpectrumSpace,
Graph,
GraphEdges,
Grassmannian,
HodgeDiscreteSpectrumSpace,
Hyperbolic,
HypercubeGraph,
Expand Down Expand Up @@ -76,14 +78,25 @@ def default_feature_map(

@overload
def feature_map_from_kernel(kernel: MaternKarhunenLoeveKernel):
if isinstance(kernel.space, CompactMatrixLieGroup):
if isinstance(kernel.space, CompactMatrixLieGroup) or isinstance(
kernel.space, Grassmannian
):
# Because `CompactMatrixLieGroup` does not currently support explicit
# eigenfunction computation (they only support addition theorem).
return RandomPhaseFeatureMapCompact(
kernel.space,
kernel.num_levels,
MaternGeometricKernel._DEFAULT_NUM_RANDOM_PHASES,
)
if isinstance(kernel.space, CompactHomogeneousSpace):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this separateif only to set different default_num?

# Same as above.
# `CompactHomogeneousSpace` does not currently support explicit
# eigenfunction computation (they only support addition theorem).
return RandomPhaseFeatureMapCompact(
kernel.space,
kernel.num_levels,
MaternGeometricKernel._DEFAULT_NUM_RANDOM_PHASES_HOMOGENEOUS_SPACE,
)
else:
return DeterministicFeatureMapCompact(kernel.space, kernel.num_levels)

Expand Down Expand Up @@ -140,6 +153,12 @@ def feature_map_from_space(space: DiscreteSpectrumSpace, num: int):
return RandomPhaseFeatureMapCompact(
space, num, MaternGeometricKernel._DEFAULT_NUM_RANDOM_PHASES
)
elif isinstance(space, CompactHomogeneousSpace):
return RandomPhaseFeatureMapCompact(
space,
num,
MaternGeometricKernel._DEFAULT_NUM_RANDOM_PHASES_HOMOGENEOUS_SPACE,
)
elif isinstance(space, Hypersphere):
num_computed_levels = space.num_computed_levels
if num_computed_levels > 0:
Expand Down Expand Up @@ -204,7 +223,9 @@ def feature_map_from_space(space: Space, num: int):

@overload
def default_num(space: DiscreteSpectrumSpace) -> int:
if isinstance(space, CompactMatrixLieGroup):
if isinstance(space, CompactMatrixLieGroup) or isinstance(
space, CompactHomogeneousSpace
):
return MaternGeometricKernel._DEFAULT_NUM_LEVELS_LIE_GROUP
elif isinstance(space, (Graph, Mesh)):
return min(
Expand Down Expand Up @@ -270,6 +291,7 @@ class MaternGeometricKernel:
_DEFAULT_NUM_LEVELS = 25
_DEFAULT_NUM_LEVELS_LIE_GROUP = 20
_DEFAULT_NUM_RANDOM_PHASES = 3000
_DEFAULT_NUM_RANDOM_PHASES_HOMOGENEOUS_SPACE = 500

def __new__(
cls,
Expand Down Expand Up @@ -335,16 +357,10 @@ def __new__(
"""

kernel: BaseGeometricKernel
if isinstance(space, DiscreteSpectrumSpace):
num = num or default_num(space)
if isinstance(space, HodgeDiscreteSpectrumSpace):
kernel = MaternHodgeCompositionalKernel(space, num, normalize=normalize)
else:
kernel = MaternKarhunenLoeveKernel(space, num, normalize=normalize)
if return_feature_map:
feature_map = default_feature_map(kernel=kernel)

elif isinstance(space, NoncompactSymmetricSpace):
if isinstance(space, NoncompactSymmetricSpace) or isinstance(
space, CompactHomogeneousSpace
):
num = num or default_num(space)
if "key" in kwargs:
key = kwargs["key"]
Expand All @@ -357,10 +373,20 @@ def __new__(
)
% str(type(space))
)

feature_map = default_feature_map(space=space, num=num)
kernel = MaternFeatureMapKernel(
space, feature_map, key, normalize=normalize
)
elif isinstance(space, DiscreteSpectrumSpace):
num = num or default_num(space)
if isinstance(space, HodgeDiscreteSpectrumSpace):
kernel = MaternHodgeCompositionalKernel(space, num, normalize=normalize)
else:
kernel = MaternKarhunenLoeveKernel(space, num, normalize=normalize)
if return_feature_map:
feature_map = default_feature_map(kernel=kernel)

else:
raise NotImplementedError

Expand Down
Loading
Loading