Browse Source

New translations structuralspKernel.py (French)

l10n_v0.2.x
linlin 4 years ago
parent
commit
0eafe640b4
1 changed files with 13 additions and 13 deletions
  1. +13
    -13
      lang/fr/gklearn/kernels/structuralspKernel.py

+ 13
- 13
lang/fr/gklearn/kernels/structuralspKernel.py View File

@@ -37,15 +37,15 @@ def structuralspkernel(*args,
n_jobs=None, n_jobs=None,
chunksize=None, chunksize=None,
verbose=True): verbose=True):
"""Calculate mean average structural shortest path kernels between graphs.
"""Compute mean average structural shortest path kernels between graphs.


Parameters Parameters
---------- ----------
Gn : List of NetworkX graph 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 G1, G2 : NetworkX graphs
Two graphs between which the kernel is calculated.
Two graphs between which the kernel is computed.


node_label : string node_label : string
Node attribute used as label. The default node label is atom. Node attribute used as label. The default node label is atom.
@@ -215,7 +215,7 @@ def structuralspkernel(*args,
from itertools import combinations_with_replacement from itertools import combinations_with_replacement
itr = combinations_with_replacement(range(0, len(Gn)), 2) itr = combinations_with_replacement(range(0, len(Gn)), 2)
if verbose: if verbose:
iterator = tqdm(itr, desc='calculating kernels', file=sys.stdout)
iterator = tqdm(itr, desc='Computing kernels', file=sys.stdout)
else: else:
iterator = itr iterator = itr
if compute_method == 'trie': if compute_method == 'trie':
@@ -241,7 +241,7 @@ def structuralspkernel(*args,
# combinations_with_replacement(splist, 2), # combinations_with_replacement(splist, 2),
# combinations_with_replacement(range(0, len(Gn)), 2)) # combinations_with_replacement(range(0, len(Gn)), 2))
# for i, j, kernel in tqdm( # for i, j, kernel in tqdm(
# pool.map(do_partial, itr), desc='calculating kernels',
# pool.map(do_partial, itr), desc='Computing kernels',
# file=sys.stdout): # file=sys.stdout):
# Kmatrix[i][j] = kernel # Kmatrix[i][j] = kernel
# Kmatrix[j][i] = kernel # Kmatrix[j][i] = kernel
@@ -263,7 +263,7 @@ def structuralspkernel(*args,
# with closing(Pool(n_jobs)) as pool: # with closing(Pool(n_jobs)) as pool:
# for i, j, kernel in tqdm( # for i, j, kernel in tqdm(
# pool.imap_unordered(do_partial, itr, 1000), # pool.imap_unordered(do_partial, itr, 1000),
# desc='calculating kernels',
# desc='Computing kernels',
# file=sys.stdout): # file=sys.stdout):
# Kmatrix[i][j] = kernel # Kmatrix[i][j] = kernel
# Kmatrix[j][i] = kernel # Kmatrix[j][i] = kernel
@@ -335,7 +335,7 @@ def structuralspkernel_do(g1, g2, spl1, spl2, ds_attrs, node_label, edge_label,
if len(p1) == len(p2): if len(p1) == len(p2):
kernel += 1 kernel += 1
try: try:
kernel = kernel / (len(spl1) * len(spl2)) # calculate mean average
kernel = kernel / (len(spl1) * len(spl2)) # Compute mean average
except ZeroDivisionError: except ZeroDivisionError:
print(spl1, spl2) print(spl1, spl2)
print(g1.nodes(data=True)) print(g1.nodes(data=True))
@@ -429,7 +429,7 @@ def ssp_do_trie(g1, g2, trie1, trie2, ds_attrs, node_label, edge_label,
# # compute graph kernels # # compute graph kernels
# traverseBothTrie(trie1[0].root, trie2[0], kernel) # traverseBothTrie(trie1[0].root, trie2[0], kernel)
# #
# kernel = kernel[0] / (trie1[1] * trie2[1]) # calculate mean average
# kernel = kernel[0] / (trie1[1] * trie2[1]) # Compute mean average


# # traverse all paths in graph1. Deep-first search is applied. # # traverse all paths in graph1. Deep-first search is applied.
# def traverseBothTrie(root, trie2, kernel, vk_dict, ek_dict, pcurrent=[]): # def traverseBothTrie(root, trie2, kernel, vk_dict, ek_dict, pcurrent=[]):
@@ -485,7 +485,7 @@ def ssp_do_trie(g1, g2, trie1, trie2, ds_attrs, node_label, edge_label,
else: else:
traverseBothTrieu(trie1[0].root, trie2[0], kernel, vk_dict, ek_dict) traverseBothTrieu(trie1[0].root, trie2[0], kernel, vk_dict, ek_dict)


kernel = kernel[0] / (trie1[1] * trie2[1]) # calculate mean average
kernel = kernel[0] / (trie1[1] * trie2[1]) # Compute mean average


return kernel return kernel


@@ -781,9 +781,9 @@ def get_shortest_paths(G, weight, directed):
Parameters Parameters
---------- ----------
G : NetworkX graphs G : NetworkX graphs
The graphs whose paths are calculated.
The graphs whose paths are computed.
weight : string/None weight : string/None
edge attribute used as weight to calculate the shortest path.
edge attribute used as weight to compute the shortest path.
directed: boolean directed: boolean
Whether graph is directed. Whether graph is directed.


@@ -822,9 +822,9 @@ def get_sps_as_trie(G, weight, directed):
Parameters Parameters
---------- ----------
G : NetworkX graphs G : NetworkX graphs
The graphs whose paths are calculated.
The graphs whose paths are computed.
weight : string/None weight : string/None
edge attribute used as weight to calculate the shortest path.
edge attribute used as weight to compute the shortest path.
directed: boolean directed: boolean
Whether graph is directed. Whether graph is directed.




Loading…
Cancel
Save