Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
49
Issues
49
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
4473f385
Commit
4473f385
authored
Jun 15, 2018
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mcmc_multilevel(): Fix problem with empty groups
parent
a60612ae
Pipeline
#417
passed with stage
in 205 minutes
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
mcmc.py
src/graph_tool/inference/mcmc.py
+8
-6
No files found.
src/graph_tool/inference/mcmc.py
View file @
4473f385
...
...
@@ -349,32 +349,34 @@ def mcmc_multilevel(state, B, r=2, b_cache=None, anneal=False,
mcmc_args
[
"allow_new_group"
]
=
False
mcmc_equilibrate_args
[
"mcmc_args"
]
=
mcmc_args
while
state
.
B
>
B
:
B_next
=
max
(
min
(
int
(
round
(
state
.
B
/
r
)),
state
.
B
-
1
),
B
)
while
state
.
get_nonempty_B
()
>
B
:
B_next
=
max
(
min
(
int
(
round
(
state
.
get_nonempty_B
()
/
r
)),
state
.
get_nonempty_B
()
-
1
),
B
)
if
b_cache
is
not
None
and
B_next
in
b_cache
:
state
=
b_cache
[
B_next
][
1
]
if
check_verbose
(
verbose
):
print
(
verbose_pad
(
verbose
)
+
"shrinking
%
d ->
%
d (cached)"
%
(
state
.
B
,
B_next
))
"shrinking
%
d ->
%
d (cached)"
%
(
state
.
get_nonempty_B
(),
B_next
))
continue
if
check_verbose
(
verbose
):
print
(
verbose_pad
(
verbose
)
+
"shrinking
%
d ->
%
d"
%
(
state
.
B
,
B_next
))
"shrinking
%
d ->
%
d"
%
(
state
.
get_nonempty_B
()
,
B_next
))
state
=
state
.
shrink
(
B
=
B_next
,
**
shrink_args
)
if
anneal
:
mcmc_anneal
(
state
,
**
dict
(
anneal_args
,
mcmc_equilibrate_args
=
mcmc_equilibrate_args
,
verbose
=
verbose_push
(
verbose
,
"B=
%
d "
%
state
.
B
)))
"B=
%
d "
%
state
.
get_nonempty_B
()
)))
else
:
mcmc_equilibrate
(
state
,
**
dict
(
mcmc_equilibrate_args
,
verbose
=
verbose_push
(
verbose
,
(
"B=
%
d "
%
state
.
B
))))
state
.
get_nonempty_B
()
))))
if
b_cache
is
not
None
:
mcmc_args
=
mcmc_equilibrate_args
.
get
(
"mcmc_args"
,
{})
entropy_args
=
mcmc_args
.
get
(
"entropy_args"
,
{})
...
...
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