gklearn.kernels.weisfeilerLehmanKernel
@author: linlin
@references:
[1] Shervashidze N, Schweitzer P, Leeuwen EJ, Mehlhorn K, Borgwardt KM. Weisfeiler-lehman graph kernels. Journal of Machine Learning Research. 2011;12(Sep):2539-61.
- compute_kernel_matrix(Kmatrix, all_num_of_each_label, Gn, parallel, n_jobs, chunksize, verbose)[source]
Compute kernel matrix using the base kernel.
- compute_subtree_kernel(num_of_each_label1, num_of_each_label2, kernel)[source]
Compute the subtree kernel.
- weisfeilerlehmankernel(*args, node_label='atom', edge_label='bond_type', height=0, base_kernel='subtree', parallel=None, n_jobs=None, chunksize=None, verbose=True)[source]
Compute Weisfeiler-Lehman kernels between graphs.
Parameters
- GnList of NetworkX graph
List of graphs between which the kernels are computed.
- G1, G2NetworkX graphs
Two graphs between which the kernel is computed.
- node_labelstring
Node attribute used as label. The default node label is atom.
- edge_labelstring
Edge attribute used as label. The default edge label is bond_type.
- heightint
Subtree height.
- base_kernelstring
Base kernel used in each iteration of WL kernel. Only default ‘subtree’ kernel can be applied for now.
- parallelNone
Which paralleliztion method is applied to compute the kernel. No parallelization can be applied for now.
- n_jobsint
Number of jobs for parallelization. The default is to use all computational cores. This argument is only valid when one of the parallelization method is applied and can be ignored for now.
Return
- KmatrixNumpy matrix
Kernel matrix, each element of which is the Weisfeiler-Lehman kernel between 2 praphs.
Notes
This function now supports WL subtree kernel only.