Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tiago Peixoto
graph-tool
Commits
55d3d90b
Commit
55d3d90b
authored
Feb 26, 2017
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NestedBlockModel: Modify MCMC sweeps to be in random hierarchical order
parent
9017394c
Pipeline
#275
failed with stage
in 1921 minutes and 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
src/graph_tool/inference/nested_blockmodel.py
src/graph_tool/inference/nested_blockmodel.py
+11
-12
No files found.
src/graph_tool/inference/nested_blockmodel.py
View file @
55d3d90b
...
...
@@ -197,10 +197,6 @@ class NestedBlockState(object):
clabel
.
fa
+=
(
clabel
.
fa
.
max
()
+
1
)
*
b
.
fa
return
clabel
def
impose_bclabels
(
self
):
for
l
in
range
(
len
(
self
.
levels
)
-
1
):
self
.
levels
[
l
].
bclabel
.
a
=
self
.
levels
[
l
+
1
].
b
.
a
def
_consistency_check
(
self
):
for
l
in
range
(
1
,
len
(
self
.
levels
)):
b
=
self
.
levels
[
l
].
b
.
fa
.
copy
()
...
...
@@ -490,6 +486,10 @@ class NestedBlockState(object):
return
state
def
_h_sweep
(
self
,
algo
,
**
kwargs
):
if
not
self
.
sampling
:
raise
ValueError
(
"NestedBlockState must be constructed with 'sampling=True'"
)
verbose
=
kwargs
.
get
(
"verbose"
,
False
)
entropy_args
=
kwargs
.
get
(
"entropy_args"
,
{})
...
...
@@ -498,17 +498,15 @@ class NestedBlockState(object):
edges_dl
=
(
l
+
1
==
len
(
self
.
levels
)
-
1
))
self
.
levels
[
l
].
_couple_state
(
self
.
levels
[
l
+
1
],
get_entropy_args
(
eargs
))
self
.
levels
[
l
+
1
].
_state
.
clear_egroups
()
self
.
levels
[
l
+
1
].
_state
.
sync_emat
()
self
.
impose_bclabels
()
dS
=
0
nmoves
=
0
c
=
kwargs
.
get
(
"c"
,
None
)
for
l
in
range
(
len
(
self
.
levels
)):
lrange
=
list
(
range
(
len
(
self
.
levels
)))
numpy
.
random
.
shuffle
(
lrange
)
for
l
in
lrange
:
if
check_verbose
(
verbose
):
print
(
verbose_pad
(
verbose
)
+
"level:"
,
l
)
if
l
>
0
:
...
...
@@ -528,12 +526,13 @@ class NestedBlockState(object):
return
S
eargs
=
dict
(
eargs
,
callback
=
callback
)
if
l
<
len
(
self
.
levels
)
-
1
:
self
.
levels
[
l
].
bclabel
.
a
=
self
.
levels
[
l
+
1
].
b
.
a
self
.
levels
[
l
].
_state
.
sync_emat
()
if
l
>
0
:
self
.
levels
[
l
].
_state
.
sync_emat
()
self
.
levels
[
l
].
_state
.
clear_egroups
()
self
.
levels
[
l
].
_state
.
rebuild_neighbour_sampler
()
if
l
<
len
(
self
.
levels
)
-
1
:
self
.
levels
[
l
+
1
].
_state
.
sync_emat
()
if
c
is
None
:
args
=
dict
(
kwargs
,
entropy_args
=
eargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment