Commit 09100295 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix some documentation typos

parent eb1eb083
Pipeline #146 passed with stage
......@@ -316,7 +316,7 @@ class BlockState(object):
return state
def get_bclabel(self):
r"""Returns a :class:`~graph_tool.PropertyMap`` corresponding to constraint
r"""Returns a :class:`~graph_tool.PropertyMap` corresponding to constraint
labels for the block graph."""
bclabel = self.bg.new_vertex_property("int")
......@@ -853,7 +853,7 @@ class BlockState(object):
return libinference.gibbs_sweep(gibbs_state, self._state,
_get_rng())
def gibbs_sweep(self, beta=1., niter=1, entropy_args={}, allow_empty=False,
def gibbs_sweep(self, beta=1., niter=1, entropy_args={}, allow_empty=True,
sequential=True, parallel=False, vertices=None,
block_list=None, verbose=False):
r"""Perform ``niter`` sweeps of a rejection-free Gibbs sampling MCMC
......@@ -951,7 +951,7 @@ class BlockState(object):
self._state, _get_rng())
def multicanonical_sweep(self, m_state, f=1., c=1., niter=1,
entropy_args={}, allow_empty=False, vertices=None,
entropy_args={}, allow_empty=True, vertices=None,
block_list=None, verbose=False):
r"""Perform ``niter`` sweeps of a non-markovian multicanonical sampling using
the Wang-Landau algorithm.
......
......@@ -51,8 +51,6 @@ class LayeredBlockState(OverlapBlockState, BlockState):
r"""The (possibly overlapping) block state of a given graph, where the edges are
divided into discrete layers.
This must be instantiated and used by functions such as :func:`mcmc_sweep`.
Parameters
----------
g : :class:`~graph_tool.Graph`
......
......@@ -93,7 +93,7 @@ def mcmc_equilibrate(state, wait=10, nbreaks=2, max_niter=numpy.inf,
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and
greedy heuristic for the inference of stochastic block models", Phys.
Rev. E 89, 012804 (2014), :doi:`10.1103/PhysRevE.89.012804`,
:arxiv:` 1310.4378`
:arxiv:`1310.4378`
"""
count = 0
......@@ -218,7 +218,7 @@ def mcmc_anneal(state, beta_range=(1., 10.), niter=100, history=False,
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and
greedy heuristic for the inference of stochastic block models", Phys.
Rev. E 89, 012804 (2014), :doi:`10.1103/PhysRevE.89.012804`,
:arxiv:` 1310.4378`
:arxiv:`1310.4378`
"""
beta = beta_range[0]
......
......@@ -45,11 +45,14 @@ class NestedBlockState(object):
Parameters
----------
g : :class:`~graph_tool.Graph`
Graph to be modelled.
Graph to be modeled.
bs : ``list`` of :class:`~graph_tool.PropertyMap` or :class:`numpy.ndarray`
Hierarchical node partition.
base_type : ``type``
State type for lowermost level (e.g. :class:`~graph_tool.inference.BlockState`)
State type for lowermost level
(e.g. :class:`~graph_tool.inference.BlockState`,
:class:`~graph_tool.inference.OverlapBlockState` or
:class:`~graph_tool.inference.LayeredBlockState`)
vweight : :class:`~graph_tool.PropertyMap` (optional, default: ``None``)
Vertex multiplicities (for block graphs).
**kwargs : keyword arguments
......@@ -192,7 +195,24 @@ class NestedBlockState(object):
return S
def entropy(self, dense=False, multigraph=True, **kwargs):
"""Compute the entropy of whole hierarchy."""
"""Compute the entropy of whole hierarchy.
Parameters
----------
dense : ``bool`` (optional, default: ``False``)
If ``True``, the "dense" variant of the entropy will be computed.
multigraph : ``bool`` (optional, default: ``True``)
If ``True``, the multigraph entropy will be used.
Notes
-----
The remaining keyword arguments are passed to the ``entropy()`` method
of the underlying state objects
(e.g. :class:`graph_tool.inference.BlockState.entropy`,
:class:`graph_tool.inference.OverlapBlockState.entropy`, or
:class:`graph_tool.inference.LayeredBlockState.entropy`).
"""
S = 0
for l in range(len(self.levels)):
S += self.level_entropy(l, dense=dense, multigraph=multigraph,
......
......@@ -40,9 +40,7 @@ from . blockmodel import *
from . blockmodel import _bm_test
class OverlapBlockState(BlockState):
r"""This class encapsulates the overlapping block state of a given graph.
This must be instantiated and used by functions such as :func:`mcmc_sweep`.
r"""The stochastic block model state of a given graph.
Parameters
----------
......@@ -431,9 +429,6 @@ class OverlapBlockState(BlockState):
{\mathcal{S}_{cm}^{(d)}} = \mathcal{S}_c^{(d)} + \sum_{i>j}\sum_{rs} \ln A^{rs}_{ij}! + \sum_i\sum_{rs} \ln A^{rs}_{ii}!!
If ``complete == False`` only the last term of the equations above will
be returned.
If ``dl == True``, the description length :math:`\mathcal{L}_t` of the
model will be returned as well:
......
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