diff --git a/lang/fr/gklearn/kernels/weisfeilerLehmanKernel.py b/lang/fr/gklearn/kernels/weisfeilerLehmanKernel.py index 222f5c5..469dcd8 100644 --- a/lang/fr/gklearn/kernels/weisfeilerLehmanKernel.py +++ b/lang/fr/gklearn/kernels/weisfeilerLehmanKernel.py @@ -32,15 +32,15 @@ def weisfeilerlehmankernel(*args, n_jobs=None, chunksize=None, verbose=True): - """Calculate Weisfeiler-Lehman kernels between graphs. + """Compute Weisfeiler-Lehman kernels between graphs. Parameters ---------- Gn : List of NetworkX graph - List of graphs between which the kernels are calculated. + List of graphs between which the kernels are computed. G1, G2 : NetworkX graphs - Two graphs between which the kernel is calculated. + Two graphs between which the kernel is computed. node_label : string Node attribute used as label. The default node label is atom. @@ -115,12 +115,12 @@ def weisfeilerlehmankernel(*args, def _wl_kernel_do(Gn, node_label, edge_label, height, parallel, n_jobs, chunksize, verbose): - """Calculate Weisfeiler-Lehman kernels between graphs. + """Compute Weisfeiler-Lehman kernels between graphs. Parameters ---------- Gn : List of NetworkX graph - List of graphs between which the kernels are calculated. + List of graphs between which the kernels are computed. node_label : string node attribute used as label. edge_label : string @@ -146,7 +146,7 @@ def _wl_kernel_do(Gn, node_label, edge_label, height, parallel, n_jobs, chunksiz # number of occurence of each label in G all_num_of_each_label.append(dict(Counter(labels_ori))) - # calculate subtree kernel with the 0th iteration and add it to the final kernel + # Compute subtree kernel with the 0th iteration and add it to the final kernel compute_kernel_matrix(Kmatrix, all_num_of_each_label, Gn, parallel, n_jobs, chunksize, False) # iterate each height @@ -255,7 +255,7 @@ def _wl_kernel_do(Gn, node_label, edge_label, height, parallel, n_jobs, chunksiz # all_labels_ori.update(labels_comp) all_num_of_each_label.append(dict(Counter(labels_comp))) - # calculate subtree kernel with h iterations and add it to the final kernel + # Compute subtree kernel with h iterations and add it to the final kernel compute_kernel_matrix(Kmatrix, all_num_of_each_label, Gn, parallel, n_jobs, chunksize, False) return Kmatrix @@ -316,7 +316,7 @@ def compute_kernel_matrix(Kmatrix, all_num_of_each_label, Gn, parallel, n_jobs, do_partial = partial(wrapper_compute_subtree_kernel, Kmatrix) parallel_gm(do_partial, Kmatrix, Gn, init_worker=init_worker, glbv=(all_num_of_each_label,), n_jobs=n_jobs, chunksize=chunksize, verbose=verbose) - elif parallel == None: + elif parallel is None: for i in range(len(Kmatrix)): for j in range(i, len(Kmatrix)): Kmatrix[i][j] = compute_subtree_kernel(all_num_of_each_label[i], @@ -345,12 +345,12 @@ def wrapper_compute_subtree_kernel(Kmatrix, itr): def _wl_spkernel_do(Gn, node_label, edge_label, height): - """Calculate Weisfeiler-Lehman shortest path kernels between graphs. + """Compute Weisfeiler-Lehman shortest path kernels between graphs. Parameters ---------- Gn : List of NetworkX graph - List of graphs between which the kernels are calculated. + List of graphs between which the kernels are computed. node_label : string node attribute used as label. edge_label : string @@ -413,7 +413,7 @@ def _wl_spkernel_do(Gn, node_label, edge_label, height): for node in G.nodes(data = True): node[1][node_label] = set_compressed[set_multisets[node[0]]] - # calculate subtree kernel with h iterations and add it to the final kernel + # Compute subtree kernel with h iterations and add it to the final kernel for i in range(0, len(Gn)): for j in range(i, len(Gn)): for e1 in Gn[i].edges(data = True): @@ -427,12 +427,12 @@ def _wl_spkernel_do(Gn, node_label, edge_label, height): def _wl_edgekernel_do(Gn, node_label, edge_label, height): - """Calculate Weisfeiler-Lehman edge kernels between graphs. + """Compute Weisfeiler-Lehman edge kernels between graphs. Parameters ---------- Gn : List of NetworkX graph - List of graphs between which the kernels are calculated. + List of graphs between which the kernels are computed. node_label : string node attribute used as label. edge_label : string @@ -491,7 +491,7 @@ def _wl_edgekernel_do(Gn, node_label, edge_label, height): for node in G.nodes(data = True): node[1][node_label] = set_compressed[set_multisets[node[0]]] - # calculate subtree kernel with h iterations and add it to the final kernel + # Compute subtree kernel with h iterations and add it to the final kernel for i in range(0, len(Gn)): for j in range(i, len(Gn)): for e1 in Gn[i].edges(data = True): @@ -504,12 +504,12 @@ def _wl_edgekernel_do(Gn, node_label, edge_label, height): def _wl_userkernel_do(Gn, node_label, edge_label, height, base_kernel): - """Calculate Weisfeiler-Lehman kernels based on user-defined kernel between graphs. + """Compute Weisfeiler-Lehman kernels based on user-defined kernel between graphs. Parameters ---------- Gn : List of NetworkX graph - List of graphs between which the kernels are calculated. + List of graphs between which the kernels are computed. node_label : string node attribute used as label. edge_label : string @@ -564,7 +564,7 @@ def _wl_userkernel_do(Gn, node_label, edge_label, height, base_kernel): for node in G.nodes(data = True): node[1][node_label] = set_compressed[set_multisets[node[0]]] - # calculate kernel with h iterations and add it to the final kernel + # Compute kernel with h iterations and add it to the final kernel Kmatrix += base_kernel(Gn, node_label, edge_label) return Kmatrix