From a8d5418431f38b92b48ec046ba3fb440d7c460d9 Mon Sep 17 00:00:00 2001 From: ErnstRoell Date: Mon, 22 Apr 2024 22:17:35 +0200 Subject: [PATCH] Update --- k_simplex2vec.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/k_simplex2vec.py b/k_simplex2vec.py index 5d1065e..6397675 100644 --- a/k_simplex2vec.py +++ b/k_simplex2vec.py @@ -96,10 +96,17 @@ def assemble(cplx, k, scheme="uniform", laziness=None): s_down = [(1, t) for (foo, t) in s_down] if scheme == "uniform-multicount": - s_neigh_idxs = [(a, hacky_get_idx(t, cplx)) for (a, t) in s_down + s_up] + s_neigh_idxs = [ + (a, hacky_get_idx(t, cplx)) for (a, t) in s_down + s_up + ] else: s_neigh_idxs = list( - set([(a, hacky_get_idx(t, cplx)) for (a, t) in s_down + s_up]) + set( + [ + (a, hacky_get_idx(t, cplx)) + for (a, t) in s_down + s_up + ] + ) ) if scheme == "uniform-lazy": @@ -110,7 +117,9 @@ def assemble(cplx, k, scheme="uniform", laziness=None): for sgn, j in s_neigh_idxs: if j == i: num_self_neigh += 1 - probs = (1.0 - laziness) / (len(s_neigh_idxs) - num_self_neigh) + probs = (1.0 - laziness) / ( + len(s_neigh_idxs) - num_self_neigh + ) else: probs = 1.0 / len(s_neigh_idxs) @@ -178,7 +187,9 @@ def load_walks(filename): return walks -def Embedding(Walks, emb_dim, epochs=5, filename="k-simplex2vec_embedding.model"): +def Embedding( + Walks, emb_dim, epochs=5, filename="k-simplex2vec_embedding.model" +): ## Performs the embedding of the $k$-simplices using the gensim word2vec package walks_str = [] for i in range(len(Walks)):