Skip to content
Snippets Groups Projects
Commit 9ee35151 authored by Fize Jacques's avatar Fize Jacques
Browse files

debug

parent d5036dab
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ NB_COM = args.nb_com
NB_ITERATION = args.nb_iterations
VERBOSE = args.verbose
FEATURES = set(args.features.split(","))
TIMEOUT = 60
dist = lambda a,b : np.linalg.norm(a-b)**2
hash_func = lambda x:"_".join(sorted([str(x[0]),str(x[1])]))
......@@ -58,9 +58,12 @@ def get_aucs(G):
traintest_split = LPEvalSplit()
traintest_split.compute_splits(H, split_alg="spanning_tree", train_frac=0.90, fe_ratio=1)
nee = LPEvaluator(traintest_split)
auc_spatial = nee.evaluate_baseline(method="spatial_link_prediction").test_scores.auroc()
auc_sbm = nee.evaluate_baseline(method="stochastic_block_model").test_scores.auroc()
auc_spatial, auc_sbm = 0, 0
try:
auc_spatial = nee.evaluate_baseline(method="spatial_link_prediction",timeout=TIMEOUT).test_scores.auroc()
auc_sbm = nee.evaluate_baseline(method="stochastic_block_model",timeout=TIMEOUT).test_scores.auroc()
except:
print("Could not compuyte AUC ! ")
return auc_sbm,auc_spatial
dist = lambda a,b : np.linalg.norm(a-b)
......@@ -82,7 +85,6 @@ block_assign = nx.get_node_attributes(G,"block")
H = G.copy()
float_epsilon = np.finfo(float).eps
df_data["p_0"] = df_data.apply(lambda x:1 if G.has_edge(x.u,x.v) else 0,axis =1)
print(df_data)
for i in range(1,NB_ITERATION+1):
old_probs = dict(df_data["hash_ p_{0}".format(i-1).split()].values)
auc_sbm,auc_spatial = get_aucs(H)
......@@ -116,7 +118,7 @@ for i in range(1,NB_ITERATION+1):
G2.nodes[n]["pos"] = pos[n]
H=G2.copy()
if VERBOSE:print(df_data)
edge_feature= {hash_func([int(row.u),int(row.v)]):[row["p_{0}".format(i)] for i in range(1,NB_ITERATION+1)] for ix,row in df_data.iterrows()}
G, _ = pp.prep_graph(G,maincc=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment