Commit c4667d6f authored by Fize Jacques's avatar Fize Jacques

add Parralelization graph embedding

parent a0519606
......@@ -116,7 +116,7 @@ cdef class DeepWalk(Base):
def extract_embedding(self, listgs):
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
......@@ -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.
: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]
model = Doc2Vec(document_collections,
vector_size = dimensions,
Markdown is supported
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