geometric-kernels / GeometricKernels

Geometric kernels on manifolds, meshes and graphs
https://geometric-kernels.github.io/
Apache License 2.0
214 stars 18 forks source link

Implementation of kernels on the edge space of graphs or simplicial complexes #139

Open cookbook-ms opened 2 months ago

cookbook-ms commented 2 months ago

This pull requests an implementation of kernels on the Edge space of a graph or a simplicial 2-complex. I implemented the following:

  1. the discrete space of edge space: written as a class in geometric_kernels/spaces/graph_edge.py, which allows backends based on numpy, pytorch and jax.
  2. tutorials on this, as how graph kernel tutorial looks like. This includes:
  1. testing on the space of GraphEdge: written in "tests/spaces/test_graph_edge.py"

Note that:

cookbook-ms commented 1 day ago

Sorry for the late updates.

In this update, we have the following changes:

  1. the space GraphEdge takes a graph and optional triangle list as inputs and builds a simplicial 2-complex. If no triangle list is provided, we look for all the 2-cliques. Of course, one can choose only using graph instead of simplicial 2-complex.
  2. the space GraphEdge gives an eigenbasis together with their Hodge type specified, so to enable Hodge-compositional kernel
  3. a Hodge-compositional kernel is enabled in a separate class MaternKarhunenLoeveKernel_HodgeCompositionEdge defined in geometric_kernels/kernels/karhunen_loeve.py which takes parameters for three subspaces as inputs.
  4. minimal changes are made in geometric_kernels/kernels/matern_kernel.py, as well as in geometric_kernels/feature_maps/deterministic.py and geometric_kernels/sampling/samplers.py, to enable the option of using Hodge-compositional kernel.
  5. tutorials in numpy, jax and pytorch are provided in notebooks/SimplicialComplex.ipynb, notebooks/backends/JAX_SimplicialComplex.ipynb, and notebooks/backends/PyTorch_SimplicialComplex.ipynb which give how to define Hodge-compositional edge kernels in a simplicial 2-complex, as well as Hodge feature maps.

Please have a look at your convenience. Thanks :)

vabor112 commented 11 hours ago

Thanks a lot, Maosheng! I plan to take a look in a week or two, after the deadline streak has passed.