gklearn.kernels.spKernel¶
@author: linlin
@references:
[1] Borgwardt KM, Kriegel HP. Shortest-path kernels on graphs. InData Mining, Fifth IEEE International Conference on 2005 Nov 27 (pp. 8-pp). IEEE.
-
spkernel
(*args, node_label='atom', edge_weight=None, node_kernels=None, parallel='imap_unordered', n_jobs=None, verbose=True)[source]¶ Calculate shortest-path kernels between graphs.
- Gn : List of NetworkX graph
- List of graphs between which the kernels are calculated.
- G1, G2 : NetworkX graphs
- Two graphs between which the kernel is calculated.
- node_label : string
- Node attribute used as label. The default node label is atom.
- edge_weight : string
- Edge attribute name corresponding to the edge weight.
- node_kernels : dict
- A dictionary of kernel functions for nodes, including 3 items: ‘symb’ for symbolic node labels, ‘nsymb’ for non-symbolic node labels, ‘mix’ for both labels. The first 2 functions take two node labels as parameters, and the ‘mix’ function takes 4 parameters, a symbolic and a non-symbolic label for each the two nodes. Each label is in form of 2-D dimension array (n_samples, n_features). Each function returns an number as the kernel value. Ignored when nodes are unlabeled.
- n_jobs : int
- Number of jobs for parallelization.
- Kmatrix : Numpy matrix
- Kernel matrix, each element of which is the sp kernel between 2 praphs.