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
b84f9818
Commit
b84f9818
authored
4 years ago
by
Fize Jacques
Browse files
Options
Downloads
Patches
Plain Diff
Debug
parent
613e6a5c
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
draw_visu.py
+1
-1
1 addition, 1 deletion
draw_visu.py
evalNE_script.py
+2
-2
2 additions, 2 deletions
evalNE_script.py
run_eval_par.py
+5
-2
5 additions, 2 deletions
run_eval_par.py
with
8 additions
and
5 deletions
draw_visu.py
+
1
−
1
View file @
b84f9818
...
...
@@ -34,7 +34,7 @@ def load_data(fn, graph_dir):
df
=
pd
.
read_csv
(
fn
,
sep
=
"
\t
"
)
df
[
"
type_graph
"
]
=
df
.
filename
.
apply
(
lambda
x
:
x
[
6
:]).
apply
(
lambda
x
:
re
.
sub
(
"
_[\d]+.gml
"
,
""
,
x
).
replace
(
"
_
"
,
"
"
))
df
[
"
parameters
"
]
=
df
.
filename
.
apply
(
lambda
x
:
get_graph_attr
(
x
,
graph_dir
))
df
[
"
sample
"
]
=
df
.
filename
.
apply
(
get_sample_id
_old
)
df
[
"
sample
"
]
=
df
.
filename
.
apply
(
get_sample_id
)
non_ne
=
{
'
random_prediction
'
,
'
common_neighbours
'
,
'
jaccard_coefficient
'
,
'
adamic_adar_index
'
,
'
preferential_attachment
'
,
'
resource_allocation_index
'
,
'
stochastic_block_model
'
,
'
stochastic_block_model_degree_corrected
'
,
'
spatial_link_prediction
'
}
...
...
This diff is collapsed.
Click to expand it.
evalNE_script.py
+
2
−
2
View file @
b84f9818
...
...
@@ -42,7 +42,7 @@ log("Building link prediction dataset...")
# Create an evaluator and generate train/test edge split
traintest_split
=
LPEvalSplit
()
try
:
traintest_split
.
compute_splits
(
G
,
split_alg
=
"
random
"
,
train_frac
=
args
.
train_frac
,
fe_ratio
=
1
)
traintest_split
.
compute_splits
(
G
,
split_alg
=
"
spanning_tree
"
,
train_frac
=
args
.
train_frac
,
fe_ratio
=
1
)
except
ValueError
:
traintest_split
.
compute_splits
(
G
,
split_alg
=
"
fast
"
,
train_frac
=
args
.
train_frac
,
fe_ratio
=
1
)
print
(
"
BEFORE
"
,
len
(
traintest_split
.
test_edges
))
...
...
@@ -88,7 +88,7 @@ if args.network_embedding:
"
python -m openne --method grarep --epochs 100
"
# "python -m openne --method lap --epochs 100",
]
edge_emb
=
[
'
average
'
,
'
hadamard
'
]
edge_emb
=
[
'
hadamard
'
]
#'average',
# Evaluate embedding methods
pbar
=
tqdm
(
enumerate
(
methods
),
disable
=
(
not
args
.
verbose
))
...
...
This diff is collapsed.
Click to expand it.
run_eval_par.py
+
5
−
2
View file @
b84f9818
...
...
@@ -16,12 +16,15 @@ parser = argparse.ArgumentParser()
parser
.
add_argument
(
"
dataset_dir
"
)
parser
.
add_argument
(
"
output_filename
"
)
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
(
"
-n
"
,
"
--n-jobs
"
,
default
=
2
,
type
=
int
)
args
=
parser
.
parse_args
()
fns
=
sorted
(
glob
.
glob
(
args
.
dataset_dir
+
"
/*.
"
+
args
.
format
))
def
run_eval
(
fn
):
command
=
"
python evalNE_script.py {0} -f {1}
"
.
format
(
fn
,
args
.
format
).
split
()
verbose_cmd
=
"
-v
"
if
args
.
verbose
else
""
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
)
if
not
output
.
returncode
==
0
:
print
(
"
Error! for the command :
"
,
"
"
.
join
(
command
))
...
...
@@ -29,7 +32,7 @@ def run_eval(fn):
all_res
=
[]
# Run link prediction
Parallel
(
n_jobs
=
4
,
backend
=
"
multiprocessing
"
)(
delayed
(
run_eval
)(
fn
)
for
fn
in
tqdm
(
fns
))
Parallel
(
n_jobs
=
args
.
n_jobs
,
backend
=
"
multiprocessing
"
)(
delayed
(
run_eval
)(
fn
)
for
fn
in
tqdm
(
fns
))
pbar
=
tqdm
(
fns
)
for
fn
in
pbar
:
...
...
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