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
9cc5cb2f
Commit
9cc5cb2f
authored
Apr 16, 2016
by
Tiago Peixoto
Browse files
Documentation and test fixes
parent
0dc50885
Pipeline
#160
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
doc/test_inference.py
View file @
9cc5cb2f
...
...
@@ -15,8 +15,8 @@ from graph_tool.all import *
import
numpy.random
from
numpy.random
import
randint
seed_rng
(
42
)
numpy
.
random
.
seed
(
42
)
seed_rng
(
42
)
graph_tool
.
inference
.
set_test
(
True
)
...
...
doc/test_inference_mcmc.py
View file @
9cc5cb2f
...
...
@@ -8,8 +8,8 @@ import numpy.random
from
numpy.random
import
randint
import
scipy.stats
seed_rng
(
43
)
numpy
.
random
.
seed
(
43
)
seed_rng
(
43
)
verbose
=
__name__
==
"__main__"
...
...
@@ -57,7 +57,7 @@ for directed in [True, False]:
for
s
in
range
(
state
.
B
):
mp
[
s
]
=
state
.
get_move_prob
(
v
,
s
,
c
)
n_samples
=
2
0000
n_samples
=
4
0000
# actual samples
samples
=
[
state
.
sample_vertex_move
(
v
,
c
)
for
i
in
range
(
n_samples
)]
...
...
@@ -110,7 +110,7 @@ for directed in [True, False]:
for
i
,
c
in
enumerate
(
cs
):
mcmc_args
=
dict
(
beta
=
1
,
c
=
c
,
niter
=
100
,
allow_empty
=
True
)
if
i
==
0
:
mcmc_equilibrate
(
state
,
mcmc_args
=
mcmc_args
,
wait
=
1000
,
mcmc_equilibrate
(
state
,
mcmc_args
=
mcmc_args
,
wait
=
1000
0
,
verbose
=
(
1
,
"c = %g (t) "
%
c
)
if
verbose
else
False
)
hists
[
c
]
=
mcmc_equilibrate
(
state
,
mcmc_args
=
mcmc_args
,
force_niter
=
1000
,
...
...
src/graph_tool/inference/blockmodel.py
View file @
9cc5cb2f
...
...
@@ -1352,7 +1352,7 @@ class BlockState(object):
... ds, nmoves = state.mcmc_sweep(niter=10)
... pe = state.collect_edge_marginals(pe)
>>> gt.bethe_entropy(g, state.B, pe)[0]
4.806605480346
...
-2.09061858931
...
"""
if
p
is
None
:
...
...
@@ -1405,7 +1405,7 @@ class BlockState(object):
... ds, nmoves = state.mcmc_sweep(niter=10)
... pv = state.collect_vertex_marginals(pv)
>>> gt.mf_entropy(g, pv)
4.
98926442780
9...
2
4.
4406605049
9...
>>> gt.graph_draw(g, pos=g.vp["pos"], vertex_shape="pie",
... vertex_pie_fractions=pv, output="polbooks_blocks_soft_B4.pdf")
<...>
...
...
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