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, chunksize=None, verbose=True)[source]

Compute shortest-path 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_weightstring

Edge attribute name corresponding to the edge weight.

node_kernelsdict

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_jobsint

Number of jobs for parallelization.

Return

KmatrixNumpy matrix

Kernel matrix, each element of which is the sp kernel between 2 praphs.

spkernel_do(g1, g2, ds_attrs, node_label, node_kernels)[source]
wrapper_getSPGraph(weight, itr_item)[source]
wrapper_sp_do(ds_attrs, node_label, node_kernels, itr)[source]