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
Malte R
graph-tool
Commits
31038455
Commit
31038455
authored
Oct 13, 2020
by
Tiago Peixoto
Browse files
Fix typo in inference HOWTO
This fixes issue
#683
parent
6ddf1e63
Changes
3
Hide whitespace changes
Inline
Side-by-side
doc/demos/inference/_edge_weights.rst
View file @
31038455
...
...
@@ -108,7 +108,7 @@ the weights, as follows:
.. testcode:: weighted-model
g = gt.collection.
konect_data["moreno_train
"]
g = gt.collection.
ns["train_terrorists
"]
# This network contains an internal edge property map with name
# "weight" that contains the strength of interactions. The values
...
...
@@ -168,7 +168,7 @@ follows:
.. testcode:: food-web
g = gt.collection.
konect_data
["foodweb
-
baywet"]
g = gt.collection.
ns
["foodweb
_
baywet"]
# This network contains an internal edge property map with name
# "weight" that contains the energy flow between species. The values
...
...
@@ -224,7 +224,7 @@ can fit this alternative model simply by using the transformed weights:
rec_types=["real-normal"]))
# improve solution with merge-split
state_ln = state.copy(bs=state.get_bs() + [np.zeros(1)] * 4, sampling=True)
state_ln = state.copy(bs=state
_ln
.get_bs() + [np.zeros(1)] * 4, sampling=True)
for i in range(100):
ret = state_ln.multiflip_mcmc_sweep(niter=10, beta=np.inf)
...
...
@@ -276,9 +276,9 @@ Therefore, we can compute the posterior odds ratio between both models as:
.. testoutput:: food-web
:options: +NORMALIZE_WHITESPACE
ln Λ: 16
490.463643
...
ln Λ: 16
506.096401
...
A value of :math:`\Lambda \approx \mathrm{e}^{16
490
} \approx 10^{716
1
}`
A value of :math:`\Lambda \approx \mathrm{e}^{16
506
} \approx 10^{716
8
}`
in favor the log-normal model indicates that the exponential model does
not provide a better fit for this particular data. Based on this, we
conclude that the log-normal model should be preferred in this case.
...
...
@@ -293,7 +293,7 @@ initialization, e.g..
.. testcode:: weighted-model
g = gt.collection.
konect_data
["foodweb
-
baywet"]
g = gt.collection.
ns
["foodweb
_
baywet"]
state = gt.NestedBlockState(g, state_args=dict(recs=[g.ep.weight], rec_types=["real-exponential"]))
...
...
doc/demos/inference/_layers.rst
View file @
31038455
...
...
@@ -37,7 +37,7 @@ separating these two types of interactions in two layers:
.. testcode:: layered-model
g = gt.collection.
konect_data["ucidata-gama
"]
g = gt.collection.
ns["new_guinea_tribes
"]
# The edge types are stored in the edge property map "weights".
...
...
doc/demos/inference/_reconstruction.rst
View file @
31038455
...
...
@@ -158,7 +158,7 @@ simple example, using
state = gt.MeasuredBlockState(g, n=n, n_default=1, x=x, x_default=0)
# We will first equilibrate the Markov chain
gt.mcmc_equilibrate(state, wait=1000, mcmc_args=dict(niter=10))
gt.mcmc_equilibrate(state, wait=1000
0
, mcmc_args=dict(niter=10))
# Now we collect the marginals for exactly 100,000 sweeps, at
# intervals of 10 sweeps:
...
...
@@ -187,9 +187,9 @@ Which yields the following output:
.. testoutput:: measured
Posterior probability of edge (11, 36): 0.
768976
...
Posterior probability of non-edge (15, 73): 0.0
39203
...
Estimated average local clustering: 0.57
1939
± 0.003
534
...
Posterior probability of edge (11, 36): 0.
829782
...
Posterior probability of non-edge (15, 73): 0.0
58105
...
Estimated average local clustering: 0.57
2087
± 0.003
632
...
We have a successful reconstruction, where both ambiguous adjacency
matrix entries are correctly recovered. The value for the average
...
...
@@ -310,9 +310,9 @@ Which yields:
.. testoutput:: measured
Posterior probability of edge (11, 36): 0.6
31563
...
Posterior probability of non-edge (15, 73): 0.0
22402
...
Estimated average local clustering: 0.5
70065
± 0.0
0714
5...
Posterior probability of edge (11, 36): 0.6
55165
...
Posterior probability of non-edge (15, 73): 0.0
13301
...
Estimated average local clustering: 0.5
53358
± 0.0
161
5...
The results are very similar to the ones obtained with the uniform model
in this case, but can be quite different in situations where a large
...
...
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