Graph Kernels
polygraph.utils.kernels.RBFKernel
Bases: DescriptorKernel[GraphType], Generic[GraphType]
Radial Basis Function (RBF) kernel, also known as Gaussian kernel.
Computes similarity using the formula:
where \(\sigma\) is the bandwidth parameter.
| Parameters: |
|
|---|
polygraph.utils.kernels.LaplaceKernel
Bases: DescriptorKernel[GraphType], Generic[GraphType]
Laplace kernel using L1 (Manhattan) distance.
Computes similarity using the formula:
where \(\lambda\) is the scale parameter.
| Parameters: |
|
|---|
polygraph.utils.kernels.GaussianTV
Bases: DescriptorKernel[GraphType], Generic[GraphType]
Gaussian kernel using L1 distance.
Computes similarity using the formula:
where \(\sigma\) is the bandwidth parameter.
Warning
This kernel is not positive definite.
| Parameters: |
|
|---|
polygraph.utils.kernels.AdaptiveRBFKernel
Bases: DescriptorKernel[GraphType], Generic[GraphType]
Adaptive RBF kernel with data-dependent bandwidth.
Similar to the standard RBF kernel but adapts its bandwidth based on the data:
where \(\sigma\) is the base bandwidth and \(c\) is a scaling factor computed from the typical distance between reference and generated graphs. Specifically, \(c\) is the square root of the mean or median of the squared \(\ell^2\) distance between reference and generated graphs.
| Parameters: |
|
|---|
polygraph.utils.kernels.LinearKernel
Bases: DescriptorKernel[GraphType], Generic[GraphType]
Simple linear kernel using dot product.
Computes similarity using the formula:
| Parameters: |
|
|---|