Graph
gpjax.kernels.non_euclidean.graph
tfb = tfp.bijectors
module-attribute
GraphKernel
dataclass
Bases: AbstractKernel
The Matérn graph kernel defined on the vertex set of a graph.
A Matérn graph kernel defined on the vertices of a graph. The key reference for this object is borovitskiy et. al., (2020).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
laplacian |
Float[Array]
|
An matrix representing the Laplacian matrix of a graph. |
static_field(None)
|
active_dims: Optional[List[int]] = static_field(None)
class-attribute
instance-attribute
ndims
property
spectral_density: Optional[tfd.Distribution]
property
laplacian: Union[Num[Array, 'N N'], None] = static_field(None)
class-attribute
instance-attribute
lengthscale: ScalarFloat = param_field(jnp.array(1.0), bijector=tfb.Softplus())
class-attribute
instance-attribute
variance: ScalarFloat = param_field(jnp.array(1.0), bijector=tfb.Softplus())
class-attribute
instance-attribute
smoothness: ScalarFloat = param_field(jnp.array(1.0), bijector=tfb.Softplus())
class-attribute
instance-attribute
eigenvalues: Union[Float[Array, 'N 1'], None] = static_field(None)
class-attribute
instance-attribute
eigenvectors: Union[Float[Array, 'N N'], None] = static_field(None)
class-attribute
instance-attribute
num_vertex: Union[ScalarInt, None] = static_field(None)
class-attribute
instance-attribute
compute_engine: AbstractKernelComputation = static_field(EigenKernelComputation(), repr=False)
class-attribute
instance-attribute
name: str = 'Graph Matérn'
class-attribute
instance-attribute
__init_subclass__(mutable: bool = False)
replace(**kwargs: Any) -> Self
replace_meta(**kwargs: Any) -> Self
update_meta(**kwargs: Any) -> Self
replace_trainable(**kwargs: Dict[str, bool]) -> Self
Replace the trainability status of local nodes of the Module.
replace_bijector(**kwargs: Dict[str, tfb.Bijector]) -> Self
Replace the bijectors of local nodes of the Module.
constrain() -> Self
unconstrain() -> Self
stop_gradient() -> Self
trainables() -> Self
cross_covariance(x: Num[Array, 'N D'], y: Num[Array, 'M D'])
gram(x: Num[Array, 'N D'])
slice_input(x: Float[Array, '... D']) -> Float[Array, '... Q']
Slice out the relevant columns of the input matrix.
Select the relevant columns of the supplied matrix to be used within the kernel's evaluation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Float[Array, '... D']
|
The matrix or vector that is to be sliced. |
required |
Returns
Float[Array, "... Q"]: A sliced form of the input matrix.
__add__(other: Union[AbstractKernel, ScalarFloat]) -> AbstractKernel
__radd__(other: Union[AbstractKernel, ScalarFloat]) -> AbstractKernel
__mul__(other: Union[AbstractKernel, ScalarFloat]) -> AbstractKernel
Multiply two kernels together.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
AbstractKernel
|
The kernel to be multiplied with the current kernel. |
required |
Returns
AbstractKernel: A new kernel that is the product of the two kernels.
__post_init__()
__call__(x: Int[Array, 'N 1'], y: Int[Array, 'N 1'], *, S, **kwargs)
Compute the (co)variance between a vertex pair.
For a graph where , evaluate the graph kernel on a pair of vertices for any .
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Float[Array, 'N 1']
|
Index of the th vertex. |
required |
y |
Float[Array, 'N 1']
|
Index of the th vertex. |
required |
Returns
ScalarFloat: The value of $k(v_i, v_j)$.