Commit c4667d6f authored by Fize Jacques's avatar Fize Jacques
Browse files

add Parralelization graph embedding

1 merge request!5Add new version : Graph Extension, Parallelization, Graph Embedding, Performance enhanced
Showing with 2 additions and 2 deletions
+2 -2
...@@ -116,7 +116,7 @@ cdef class DeepWalk(Base): ...@@ -116,7 +116,7 @@ cdef class DeepWalk(Base):
def extract_embedding(self, listgs): def extract_embedding(self, listgs):
from tqdm import tqdm from tqdm import tqdm
models = [process(nx.Graph(g)) for g in tqdm(listgs,desc="Extracting Embeddings...")] models = Parallel(n_jobs = cpu_count())(delayed(process)(nx.Graph(g)) for g in tqdm(listgs,desc="Extracting Embeddings..."))
return models return models
@cython.boundscheck(False) @cython.boundscheck(False)
......
...@@ -89,7 +89,7 @@ def generate_model(graphs, iteration = 2, dimensions = 64, min_count = 5, down_s ...@@ -89,7 +89,7 @@ def generate_model(graphs, iteration = 2, dimensions = 64, min_count = 5, down_s
Main function to read the graph list, extract features, learn the embedding and save it. Main function to read the graph list, extract features, learn the embedding and save it.
:param args: Object with the arguments. :param args: Object with the arguments.
""" """
document_collections = [feature_extractor(g, ix,iteration) for ix,g in tqdm(enumerate(graphs),desc="Extracting Features...")] document_collections = Parallel(n_jobs = workers)(delayed(feature_extractor)(g, ix,iteration) for ix,g in tqdm(enumerate(graphs),desc="Extracting Features..."))
graphs=[nx.relabel_nodes(g,{node:str(node) for node in list(g.nodes)},copy=True) for g in graphs] graphs=[nx.relabel_nodes(g,{node:str(node) for node in list(g.nodes)},copy=True) for g in graphs]
model = Doc2Vec(document_collections, model = Doc2Vec(document_collections,
vector_size = dimensions, vector_size = dimensions,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment