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
635dffad
Commit
635dffad
authored
4 years ago
by
Fize Jacques
Browse files
Options
Downloads
Patches
Plain Diff
debug
parent
a132c1fe
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
lib/erosion_model.py
+22
-2
22 additions, 2 deletions
lib/erosion_model.py
with
22 additions
and
2 deletions
lib/erosion_model.py
+
22
−
2
View file @
635dffad
...
...
@@ -15,7 +15,7 @@ import networkx as nx
import
numpy
as
np
float_epsilon
=
np
.
finfo
(
float
).
eps
VERBOSE
=
Fals
e
VERBOSE
=
Tru
e
def
log
(
x
):
if
VERBOSE
:
print
(
x
)
...
...
@@ -146,10 +146,30 @@ class ErosionModel():
return
X_train
,
X_test
,
y_train
,
y_test
def
position_str_process
(
G
):
def
foo
(
x
):
return
[
eval
(
f
)
for
f
in
re
.
findall
(
"
[-]?\d+.[-]?[\de+-]+
"
,
x
)]
is_pos
=
True
H
=
G
.
copy
()
for
n
in
list
(
H
.
nodes
()):
if
not
"
pos
"
in
H
.
nodes
[
n
]:
is_pos
=
False
break
if
is_pos
:
import
re
for
node
in
list
(
G
.
nodes
()):
try
:
H
.
nodes
[
node
][
"
pos
"
]
=
foo
(
H
.
nodes
[
node
][
"
pos
"
])
except
TypeError
:
pass
return
H
def
eval_erosion_model
(
G
,
nb_iter
=
1
,
verbose
=
False
):
G
=
position_str_process
(
G
)
erod_mod
=
ErosionModel
(
G
)
erod_mod
.
erode_n_times
(
nb_iter
)
X_train
,
X_test
,
y_train
,
y_test
=
erod_mod
.
get_features
()
X_train
,
X_test
,
y_train
,
y_test
=
erod_mod
.
get_features
(
True
,
True
,
True
)
auc_sbm
,
auc_spa
=
get_auc_heuristics
(
G
,
60
)
if
verbose
:
print
(
"
SBM:
"
,
auc_sbm
,
"
SPATIAL:
"
,
auc_spa
)
...
...
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