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
ac8806e1
Commit
ac8806e1
authored
4 years ago
by
Fize Jacques
Browse files
Options
Downloads
Patches
Plain Diff
Debug Node2vec
parent
c2b03d9b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
evalNE_script.py
+7
-3
7 additions, 3 deletions
evalNE_script.py
generate_theoric_random_graph.py
+1
-1
1 addition, 1 deletion
generate_theoric_random_graph.py
run_eval.py
+3
-2
3 additions, 2 deletions
run_eval.py
with
11 additions
and
6 deletions
evalNE_script.py
+
7
−
3
View file @
ac8806e1
...
@@ -42,11 +42,12 @@ log("Building link prediction dataset...")
...
@@ -42,11 +42,12 @@ log("Building link prediction dataset...")
# Create an evaluator and generate train/test edge split
# Create an evaluator and generate train/test edge split
traintest_split
=
LPEvalSplit
()
traintest_split
=
LPEvalSplit
()
try
:
try
:
traintest_split
.
compute_splits
(
G
,
split_alg
=
"
spanning_tree
"
,
train_frac
=
args
.
train_frac
,
fe_ratio
=
1
)
traintest_split
.
compute_splits
(
G
,
split_alg
=
"
random
"
,
train_frac
=
args
.
train_frac
,
fe_ratio
=
1
)
except
ValueError
:
except
ValueError
:
traintest_split
.
compute_splits
(
G
,
split_alg
=
"
fast
"
,
train_frac
=
args
.
train_frac
,
fe_ratio
=
1
)
traintest_split
.
compute_splits
(
G
,
split_alg
=
"
fast
"
,
train_frac
=
args
.
train_frac
,
fe_ratio
=
1
)
print
(
"
BEFORE
"
,
len
(
traintest_split
.
test_edges
))
nee
=
LPEvaluator
(
traintest_split
)
nee
=
LPEvaluator
(
traintest_split
)
print
(
"
AFTER
"
,
len
(
traintest_split
.
test_edges
))
log
(
"
Dataset Built !
"
)
log
(
"
Dataset Built !
"
)
# Create a Scoresheet to store the results
# Create a Scoresheet to store the results
...
@@ -93,9 +94,12 @@ if args.network_embedding:
...
@@ -93,9 +94,12 @@ if args.network_embedding:
pbar
=
tqdm
(
enumerate
(
methods
),
disable
=
(
not
args
.
verbose
))
pbar
=
tqdm
(
enumerate
(
methods
),
disable
=
(
not
args
.
verbose
))
for
i
,
method
in
pbar
:
for
i
,
method
in
pbar
:
pbar
.
set_description
(
"
Evaluate
"
+
method
)
pbar
.
set_description
(
"
Evaluate
"
+
method
)
is_weighted
=
nx
.
is_weighted
(
G
)
command
=
commands
[
i
]
+
"
--input {} --output {} --representation-size {}
"
command
=
commands
[
i
]
+
"
--input {} --output {} --representation-size {}
"
if
is_weighted
:
command
=
command
+
"
--weighted
"
results
=
nee
.
evaluate_cmd
(
method_name
=
methods
[
i
],
method_type
=
'
ne
'
,
command
=
command
,
results
=
nee
.
evaluate_cmd
(
method_name
=
methods
[
i
],
method_type
=
'
ne
'
,
command
=
command
,
edge_embedding_methods
=
edge_emb
,
input_delim
=
'
'
,
output_delim
=
'
'
,
verbose
=
args
.
verbose
,
write_weights
=
nx
.
is_weighted
(
G
)
)
edge_embedding_methods
=
edge_emb
,
input_delim
=
'
'
,
output_delim
=
'
'
,
verbose
=
args
.
verbose
,
write_weights
=
is_weighted
)
scoresheet
.
log_results
(
results
)
scoresheet
.
log_results
(
results
)
except
ImportError
:
except
ImportError
:
...
...
This diff is collapsed.
Click to expand it.
generate_theoric_random_graph.py
+
1
−
1
View file @
ac8806e1
...
@@ -18,7 +18,7 @@ args = parser.parse_args()
...
@@ -18,7 +18,7 @@ args = parser.parse_args()
GRAPH_SIZE
=
[
80
,
800
]
GRAPH_SIZE
=
[
80
,
800
]
EDGE_SIZE
=
[
2
,
3
]
EDGE_SIZE
=
[
2
,
4
,
5
]
sample_per_params
=
4
sample_per_params
=
4
OUTPUT_DIR
=
args
.
output_dir
OUTPUT_DIR
=
args
.
output_dir
...
...
This diff is collapsed.
Click to expand it.
run_eval.py
+
3
−
2
View file @
ac8806e1
...
@@ -16,6 +16,7 @@ parser.add_argument("dataset_dir")
...
@@ -16,6 +16,7 @@ parser.add_argument("dataset_dir")
parser
.
add_argument
(
"
output_filename
"
)
parser
.
add_argument
(
"
output_filename
"
)
parser
.
add_argument
(
"
-f
"
,
"
--format
"
,
default
=
"
gexf
"
,
choices
=
[
"
gexf
"
,
"
gml
"
,
"
txt
"
])
parser
.
add_argument
(
"
-f
"
,
"
--format
"
,
default
=
"
gexf
"
,
choices
=
[
"
gexf
"
,
"
gml
"
,
"
txt
"
])
parser
.
add_argument
(
"
-t
"
,
"
--train-frac
"
,
default
=
0.9
,
type
=
float
)
parser
.
add_argument
(
"
-t
"
,
"
--train-frac
"
,
default
=
0.9
,
type
=
float
)
parser
.
add_argument
(
"
-v
"
,
"
--verbose
"
,
action
=
"
store_true
"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
fns
=
sorted
(
glob
.
glob
(
args
.
dataset_dir
+
"
/*.
"
+
args
.
format
))
fns
=
sorted
(
glob
.
glob
(
args
.
dataset_dir
+
"
/*.
"
+
args
.
format
))
...
@@ -24,9 +25,9 @@ all_res = []
...
@@ -24,9 +25,9 @@ all_res = []
pbar
=
tqdm
(
fns
)
pbar
=
tqdm
(
fns
)
for
fn
in
pbar
:
for
fn
in
pbar
:
pbar
.
set_description
(
"
run eval on
"
+
fn
)
pbar
.
set_description
(
"
run eval on
"
+
fn
)
verbose_cmd
=
"
-v
"
if
args
.
v
else
""
if
not
os
.
path
.
exists
(
fn
+
"
_results_lp
"
):
if
not
os
.
path
.
exists
(
fn
+
"
_results_lp
"
):
command
=
"
python evalNE_script.py {0} -f {1} -n --train-frac {2}
"
.
format
(
fn
,
args
.
format
,
args
.
train_frac
).
split
()
command
=
"
python evalNE_script.py {0} -f {1} -n --train-frac {2}
{3}
"
.
format
(
fn
,
args
.
format
,
args
.
train_frac
,
verbose_cmd
).
split
()
output
=
subprocess
.
run
(
command
)
output
=
subprocess
.
run
(
command
)
if
not
output
.
returncode
==
0
:
if
not
output
.
returncode
==
0
:
print
(
"
Error! for the command :
"
,
"
"
.
join
(
command
))
print
(
"
Error! for the command :
"
,
"
"
.
join
(
command
))
...
...
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