Commit 9cc5cb2f authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Documentation and test fixes

parent 0dc50885
Pipeline #160 failed with stage
......@@ -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)
......
......@@ -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 = 20000
n_samples = 40000
# 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=10000,
verbose=(1, "c = %g (t) " % c) if verbose else False)
hists[c] = mcmc_equilibrate(state, mcmc_args=mcmc_args,
force_niter=1000,
......
......@@ -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.989264427809...
24.44066050499...
>>> gt.graph_draw(g, pos=g.vp["pos"], vertex_shape="pie",
... vertex_pie_fractions=pv, output="polbooks_blocks_soft_B4.pdf")
<...>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment