Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
linkprediction_depo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jacques Fize
linkprediction_depo
Commits
f8b664ba
Commit
f8b664ba
authored
4 years ago
by
Fize Jacques
Browse files
Options
Downloads
Patches
Plain Diff
add run_eval script
parent
8376d2c5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
run_eval.py
+35
-0
35 additions, 0 deletions
run_eval.py
with
35 additions
and
0 deletions
run_eval.py
0 → 100644
+
35
−
0
View file @
f8b664ba
# 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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment