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
0f3317b7
Commit
0f3317b7
authored
4 years ago
by
Fize Jacques
Browse files
Options
Downloads
Patches
Plain Diff
debug
parent
3f215891
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/random.py
+3
-3
3 additions, 3 deletions
lib/random.py
with
3 additions
and
3 deletions
lib/random.py
+
3
−
3
View file @
0f3317b7
...
...
@@ -459,7 +459,7 @@ def mixed_model_spat_sbm(nb_nodes, nb_edges, nb_com, alpha, percentage_edge_betw
G
=
spatial_graph
(
nb_nodes
,
nb_edges
,
coords
=
"
random
"
,
dist_func
=
dist_func
)
G
=
add_partitions_G
(
G
,
nb_com
)
nb_edges
=
G
.
size
()
float_epsilon
=
np
.
finfo
(
float
).
eps
def
nb_of_pair
(
N
):
return
(
N
*
(
N
-
1
))
/
2
...
...
@@ -484,9 +484,9 @@ def mixed_model_spat_sbm(nb_nodes, nb_edges, nb_com, alpha, percentage_edge_betw
all_probs_sbm
=
np
.
concatenate
((
probs_sbm_inter
,
probs_sbm_intra
))
all_probs_sbm
/=
all_probs_sbm
.
sum
()
all_probs_spa
=
np
.
asarray
([
1
/
dist_func
(
edge
[
0
],
edge
[
1
])
for
edge
in
all_edges
])
pos
=
nx
.
get_node_attributes
(
G
,
"
pos
"
)
all_probs_spa
=
np
.
asarray
([
1
/
(
float_epsilon
+
dist_func
(
pos
[
edge
[
0
]],
pos
[
edge
[
1
]]))
for
edge
in
all_edges
])
all_probs_spa
/=
all_probs_spa
.
sum
()
all_probs
=
alpha
*
(
all_probs_sbm
)
+
(
1
-
alpha
)
*
all_probs_spa
final_edges
=
[]
...
...
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