gklearn.kernels.untilHPathKernel

@author: linlin

@references:

[1] Liva Ralaivola, Sanjay J Swamidass, Hiroto Saigo, and Pierre Baldi. Graph kernels for chemical informatics. Neural networks, 18(8):1093–1110, 2005.
find_all_path_as_trie(G, length, ds_attrs, node_label='atom', edge_label='bond_type')[source]
find_all_paths_until_length(G, length, ds_attrs, node_label='atom', edge_label='bond_type', tolabelseqs=True)[source]

Find all paths no longer than a certain maximum length in a graph. A recursive depth first search is applied.

G : NetworkX graphs
The graph in which paths are searched.
length : integer
The maximum length of paths.
ds_attrs: dict
Dataset attributes.
node_label : string
Node attribute used as label. The default node label is atom.
edge_label : string
Edge attribute used as label. The default edge label is bond_type.
path : list
List of paths retrieved, where for unlabeled graphs, each path is represented by a list of nodes; while for labeled graphs, each path is represented by a list of strings consists of labels of nodes and/or edges on that path.
paths2labelseqs(plist, G, ds_attrs, node_label, edge_label)[source]
untilhpathkernel(*args, node_label='atom', edge_label='bond_type', depth=10, k_func='MinMax', compute_method='trie', parallel='imap_unordered', n_jobs=None, verbose=True)[source]

Calculate path graph kernels up to depth/hight h 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_label : string
Edge attribute used as label. The default edge label is bond_type.
depth : integer
Depth of search. Longest length of paths.
k_func : function

A kernel function applied using different notions of fingerprint similarity, defining the type of feature map and normalization method applied for the graph kernel. The Following choices are available:

‘MinMax’: use the MiniMax kernel and counting feature map.

‘tanimoto’: use the Tanimoto kernel and binary feature map.

None: no sub-kernel is used, the kernel is computed directly.

compute_method : string

Computation method to store paths and compute the graph kernel. The Following choices are available:

‘trie’: store paths as tries.

‘naive’: store paths to lists.

n_jobs : int
Number of jobs for parallelization.
Kmatrix : Numpy matrix
Kernel matrix, each element of which is the path kernel up to h between 2 praphs.
wrapper_find_all_path_as_trie(length, ds_attrs, node_label, edge_label, itr_item)[source]
wrapper_find_all_paths_until_length(length, ds_attrs, node_label, edge_label, tolabelseqs, itr_item)[source]
wrapper_uhpath_do_kernelless(k_func, itr)[source]
wrapper_uhpath_do_naive(k_func, itr)[source]
wrapper_uhpath_do_trie(k_func, itr)[source]