diff --git a/gmatch4py/embedding/deepwalk.pyx b/gmatch4py/embedding/deepwalk.pyx index 20232598b6579bf67d6530c3bafc9d61a572ed1c..104ab042fd94049314934460fb733badd1644218 100644 --- a/gmatch4py/embedding/deepwalk.pyx +++ b/gmatch4py/embedding/deepwalk.pyx @@ -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 @cython.boundscheck(False) diff --git a/gmatch4py/embedding/graph2vec.pyx b/gmatch4py/embedding/graph2vec.pyx index 727baa32f279821f74a054a21a2d0aae81318772..669666240551f56eea43f356b237aab95b3b6b26 100644 --- a/gmatch4py/embedding/graph2vec.pyx +++ b/gmatch4py/embedding/graph2vec.pyx @@ -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,