Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
080938d8
Commit
080938d8
authored
Oct 27, 2019
by
Tiago Peixoto
Browse files
Fix swap counting in TemperingState
parent
cdcddcc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/inference/mcmc.py
View file @
080938d8
...
...
@@ -648,6 +648,7 @@ class TemperingState(object):
verbose
=
kwargs
.
get
(
"verbose"
,
False
)
eargs
=
kwargs
.
get
(
"entropy_args"
,
{})
self
.
swap_attempts
+=
1
idx
=
numpy
.
arange
(
len
(
self
.
states
)
-
1
)
numpy
.
random
.
shuffle
(
idx
)
nswaps
=
0
...
...
@@ -677,7 +678,6 @@ class TemperingState(object):
ddS
=
-
(
P1_f
+
P2_f
-
P1_b
-
P2_b
)
self
.
swap_attempts
+=
1
if
ddS
<
0
or
numpy
.
random
.
random
()
<
exp
(
-
ddS
):
self
.
states
[
j
],
self
.
states
[
i
],
self
.
idx
[
j
],
self
.
idx
[
i
]
=
\
self
.
states
[
i
],
self
.
states
[
j
],
self
.
idx
[
i
],
self
.
idx
[
j
]
...
...
Write
Preview
Supports
Markdown
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