An R testing suite for the "graph-kernels" package using the support vector machine implementation in the "kernlab" package.
The file read_data.R contains a modified function from https://github.com/BorgwardtLab/graph-kernels that allows for igraph data sets to be read and stored in lists.
See the document https://arxiv.org/abs/2208.04929 for a general overview of the graph kernel literature.
Available kernels:
Kernel Name | Kernel Key | Hyperparameter |
---|---|---|
Vertex Histogram | "VH" | NA |
Gaussian Vertex Histogram | "VHG" | RBF parameter σ |
Vertex-Edge Histogram Kernel | "VEH" | NA |
Gaussian Vertex Edge Histogram | "VEHG" | RBF parameter σ |
Vertex Vertex-edge Histogram | "VVHG" | "VEH" Scalar |
Edge Histogram | "EH" | NA |
Gaussian Edge Histogram | "EHG" | RBF parameter σ |
Weisfeiler-Lehman subtree | "WL" | Number of iterations |
Geometric Random Walk | "GR" | Weight Coefficient |
Exponential Random Walk | "ER" | Weight Coefficient |
Shortest-Path | "SP" | NA |
How to use:
- Download package and set your working directory to ./GraphKernels
- Create "cache" and "figure" directories in the working directory
- Unzip data_graphml.zip contents, and select the appropriate file based on operating system
- Place all contents of the selected folder in a directory titled "data", and place "data" in the root directory
> mutag <- read.dataset("mutag")
> C <- c(2^-7,2^-5,2^-3,2^-1,2,2^3,2^5,2^7)
> h <- c(1,2,3,4,5,6,7,8,9,10)
> runExperiment(dataset = mutag, kernel = "VH", runs = 10, cost = C)
> runExperiment(dataset = mutag, kernel = "WL", runs = 10, hyperparameter = h, cost = C)
> processData()
A MATLAB script for testing graph kernels from the package available at https://bsse.ethz.ch/mlcb/research/machine-learning/graph-kernels/weisfeiler-lehman-graph-kernels.html by Nino Shervashidze and Karsten M. Borgwardt. Requires installation of the MATLAB version of LIBSVM for classification. LIBSVM is available at https://www.csie.ntu.edu.tw/~cjlin/libsvm/.
This script contains code to perform automatic cost tuning, as well as tuning via cross-validation and then the construction of a final classifier for prediction on dedicated testing sets.
How to use:
- Install LIBSVM into MATLAB
- Install the graph kernel package from https://bsse.ethz.ch/mlcb/research/machine-learning/graph-kernels/weisfeiler-lehman-graph-kernels.html into MATLAB
- Unzip the MATLAB dataset file and place the files in the same director as the code in step 2
- Add both LIBSVM and the graph kernels on the path
- Run the given analysis.m script found in src. Note that it comes ready with an example using the script