Hadamard Code Kernel¶
A similar framework to the neighborhood-hashing kernel and the Weisfeiler-Lehman kernel was introduced by Tetsuya Kataoka and Akihito Inokuchi in [KI16], known as Hadamard-code kernel. Given a collection of labeled graphs \(\mathbf{G}=[G]^{N}_{i=1}\) collect the set \(\Sigma\) of all distinct labels inside \(\mathbf{G}\). A \(2^{k}\)-th Hadamard code matrix \(H_{2^{k}}\) is defined as follows:
Now by defining a Hadamard matrix \(\mathbb{H} = H_{2^{\lceil \log_{2}|\Sigma|\rceil}}\), then we initially label each node inside a graph:
Based on this initial labeling the following relabeling rule:
was used. \(N(v)\) is used to denote the neighborhood of a node \(v\). Following the above scheme, relabeling is applied iteratively for a fixed number of iterations, while each kernel matrix (calculated from a give base-kernel) between relabeled graphs is aggregated to a total one, through summation.
The implementation of the hadamard code kernel framework can be found below. Note that use can use base_kernel
to attach as a base kernel any kernel for labeled graphs.
|
The simple Hadamard code kernel, as proposed in [KI16]. |