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

add run_eval script

parent 8376d2c5
No related branches found
No related tags found
No related merge requests found
# coding = utf-8
import glob
import subprocess
from lib.helpers import parse_evalne_output
from lib.utils import load_edgelist
import os
import pandas as pd
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("dataset_dir")
parser.add_argument("output_filename")
args = parser.parse_args()
fns = glob.glob(args.dataset_dir + "/*.txt")
all_res = []
for fn in tqdm(fns):
print("run eval on ", fn)
command = "python evalNE_script.py {0} -v".format(fn).split()
output = subprocess.run(command)
if not output.returncode == 0:
print("Error! for the command :", " ".join(command))
continue
df_results = parse_evalne_output(open(fn + "_results_lp").read())
name = os.path.basename(fn)
edge_len = len(pd.read_csv(fn, sep="\t", header=None))
df_results["nb_edge"] = edge_len
df_results["filename"] = name
all_res.append(df_results)
pd.concat(all_res).to_csv(args.output_filename,sep="\t",index=None)
\ No newline at end of file
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