grf_gp.kernels.diffusion module

class grf_gp.kernels.diffusion.DiffusionExactKernel(L, **kwargs)

Bases: BaseExactKernel, DiffusionModule

Exact diffusion kernel defined from the graph Laplacian.

class grf_gp.kernels.diffusion.DiffusionGRFKernel(rw_mats, max_walk_length, **kwargs)

Bases: BaseGRFKernel, DiffusionModule

GRF kernel with diffusion-based modulation.

property modulation_function

Return the diffusion modulation coefficients.

Returns:

Diffusion modulation vector indexed by walk length.

class grf_gp.kernels.diffusion.DiffusionLowRankGRFKernel(rw_mats, max_walk_length, proj_dim, jlt_seed=42, **kwargs)

Bases: LowRankGRFKernel, DiffusionModule

Low-rank GRF kernel with diffusion-based modulation.

property modulation_function

Return the diffusion modulation coefficients.

Returns:

Diffusion modulation vector indexed by walk length.

class grf_gp.kernels.diffusion.DiffusionModule

Bases: object

Shared logic for diffusion parameters and modulation.

property beta

Return the positive diffusion rate.

Returns:

Softplus-transformed diffusion rate.

compute_modulation(max_walk_length)

Compute diffusion modulation coefficients up to a walk length cutoff.

Parameters:

max_walk_length – Number of walk lengths to include.

Returns:

Diffusion modulation vector.

property sigma_f

Return the positive output scale.

Returns:

Softplus-transformed output scale.

grf_gp.kernels.diffusion.diffusion_formula(length: Tensor, beta: Tensor) Tensor

Compute the diffusion modulation term.

\[f(\ell, \beta) = \frac{(-\beta)^\ell}{2^\ell \, \Gamma(\ell + 1)}\]

where \(\ell\) is the walk length and \(\beta\) the diffusion rate.

Parameters:
  • length – Walk lengths \(\ell\).

  • beta – Diffusion rate \(\beta\).

Returns:

Diffusion modulation coefficients for each walk length.