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
50b7f803
Commit
50b7f803
authored
Feb 14, 2018
by
Tiago Peixoto
Browse files
inference: Add parameter r to TemperingState
parent
afd7243a
Changes
1
Show whitespace changes
Inline
Side-by-side
src/graph_tool/inference/mcmc.py
View file @
50b7f803
...
...
@@ -701,24 +701,32 @@ class TemperingState(object):
def
mcmc_sweep
(
self
,
**
kwargs
):
"""Perform a full mcmc sweep of the parallel states, where swap or moves are
chosen randomly. All keyword arguments are propagated to the individual
states' `mcmc_sweep()` method."""
chosen randomly. It accepts an keyword argument ``r`` (default: ``0.1``)
specifying the relative probability with which state swaps is performed
with respect to node moves. All remaining keyword arguments are
propagated to the individual states' `mcmc_sweep()` method.
"""
algo
=
(
lambda
s
,
**
kw
:
s
.
mcmc_sweep
(
**
kw
),
lambda
states
,
sweeps
:
type
(
self
.
states
[
0
]).
_mcmc_sweep_parallel_dispatch
(
states
,
sweeps
))
return
self
.
_sweep
(
algo
,
**
kwargs
)
def
multiflip_mcmc_sweep
(
self
,
**
kwargs
):
"""Perform a full mcmc sweep of the parallel states, where swap or moves are
chosen randomly. All keyword arguments are propagated to the individual
states' `mcmc_sweep()` method."""
chosen randomly. It accepts an keyword argument ``r`` (default: ``0.1``)
specifying the relative probability with which state swaps is performed
with respect to node moves. All remaining keyword arguments are
propagated to the individual states' `mcmc_sweep()` method.
"""
algo
=
(
lambda
s
,
**
kw
:
s
.
multiflip_mcmc_sweep
(
**
kw
),
lambda
states
,
sweeps
:
type
(
self
.
states
[
0
]).
_multiflip_mcmc_sweep_parallel_dispatch
(
states
,
sweeps
))
return
self
.
_sweep
(
algo
,
**
kwargs
)
def
gibbs_sweep
(
self
,
**
kwargs
):
"""Perform a full Gibbs mcmc sweep of the parallel states, where swap or moves
are chosen randomly. All keyword arguments are propagated to the
individual states' `gibbs_sweep()` method.
are chosen randomly. It accepts an keyword argument ``r`` (default:
``0.1``) specifying the relative probability with which state swaps is
performed with respect to node moves. All remaining keyword arguments
are propagated to the individual states' `gibbs_sweep()` method.
"""
algo
=
(
lambda
s
,
**
kw
:
s
.
gibbs_sweep
(
**
kw
),
lambda
states
,
sweeps
:
type
(
self
.
states
[
0
]).
_gibbs_sweep_parallel_dispatch
(
states
,
sweeps
))
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment