__init__.py 7.08 KB
Newer Older
1
2
3
4
5
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# graph_tool -- a general graph manipulation python module
#
Tiago Peixoto's avatar
Tiago Peixoto committed
6
# Copyright (C) 2006-2022 Tiago de Paula Peixoto <tiago@skewed.de>
7
#
8
9
10
11
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later version.
12
#
13
14
15
16
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
17
#
18
19
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21
22
23
24
25
26
27


"""``graph_tool.inference`` - Statistical inference of generative network models
-----------------------------------------------------------------------------

This module contains algorithms for the identification of large-scale network
structure via the statistical inference of generative models.

28
29
30
31
32
.. note::

   An introduction to the concepts used here, as well as a basic HOWTO is
   included in the cookbook section: :ref:`inference-howto`.

33
34
Nonparametric stochastic block model inference
++++++++++++++++++++++++++++++++++++++++++++++
35
36
37
38

High-level functions
====================

Tiago Peixoto's avatar
Tiago Peixoto committed
39
40
.. currentmodule:: graph_tool.inference

41
42
43
.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
44
45
   minimize_blockmodel_dl
   minimize_nested_blockmodel_dl
46
47
48
49
50
51
52

State classes
=============

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
53
54
55
56
57
58
59
60
61
   BlockState
   OverlapBlockState
   LayeredBlockState
   NestedBlockState
   PPBlockState
   ModularityState
   NormCutState
   TemperingState
   CliqueState
62

Tiago Peixoto's avatar
Tiago Peixoto committed
63
64
65
66
67
Abstract base classes
=====================
.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
68
69
70
71
72
73
   MCMCState
   MultiflipMCMCState
   MultilevelMCMCState
   GibbsMCMCState
   MulticanonicalMCMCState
   ExhaustiveSweepState
Tiago Peixoto's avatar
Tiago Peixoto committed
74

75
76
77
78
79
80
Sampling and minimization
=========================

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
81
82
83
84
   mcmc_equilibrate
   mcmc_anneal
   multicanonical_equilibrate
   MulticanonicalState
85

86
87
88
89
90
91
Comparing and manipulating partitions
=====================================

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
   PartitionModeState
   ModeClusterState
   PartitionCentroidState
   partition_overlap
   nested_partition_overlap
   variation_information
   mutual_information
   reduced_mutual_information
   contingency_graph
   shuffle_partition_labels
   order_partition_labels
   order_nested_partition_labels
   align_partition_labels
   align_nested_partition_labels
   partition_overlap_center
   nested_partition_overlap_center
   nested_partition_clear_null
   contiguous_map
   nested_contiguous_map
111

112
113
114
115
116
117
Auxiliary functions
===================

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
118
119
120
121
122
123
   mf_entropy
   bethe_entropy
   microstate_entropy
   marginal_multigraph_entropy
   half_edge_graph
   get_block_edge_gradient
124

125
126
127
128
129
130
Auxiliary classes
=================

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
131
132
   PartitionHist
   BlockPairHist
133
134
135
136
137
138
139
140
141
142

Nonparametric network reconstruction
++++++++++++++++++++++++++++++++++++

State classes
=============

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
143
144
145
146
147
148
149
150
151
152
153
154
155
156
   LatentMultigraphBlockState
   LatentClosureBlockState
   MeasuredBlockState
   MeasuredClosureBlockState
   MixedMeasuredBlockState
   UncertainBlockState
   UncertainBaseState
   DynamicsBlockStateBase
   EpidemicsBlockState
   IsingBaseBlockState
   IsingGlauberBlockState
   CIsingGlauberBlockState
   PseudoIsingBlockState
   PseudoCIsingBlockState
157

Tiago Peixoto's avatar
Tiago Peixoto committed
158
159
160
161
162
163
Expectation-maximization Inference
==================================

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
164
   latent_multigraph
Tiago Peixoto's avatar
Tiago Peixoto committed
165

166
167
Semiparametric stochastic block model inference
+++++++++++++++++++++++++++++++++++++++++++++++
168
169
170
171
172
173
174

State classes
=============

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
175
   EMBlockState
176
177
178
179
180
181
182

Expectation-maximization Inference
==================================

.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
183
   em_infer
184

185
186
Large-scale descriptors
+++++++++++++++++++++++
187

188
189
190
.. autosummary::
   :nosignatures:

Tiago Peixoto's avatar
Tiago Peixoto committed
191
   modularity
192

193
194
195
196
197
198
199
200
201
202
203
Contents
++++++++

"""

__all__ = ["minimize_blockmodel_dl",
           "minimize_nested_blockmodel_dl",
           "BlockState",
           "OverlapBlockState",
           "LayeredBlockState",
           "NestedBlockState",
204
           "PPBlockState",
205
           "PartitionCentroidState",
206
207
           "PartitionModeState",
           "ModeClusterState",
208
           "ModularityState",
209
           "NormCutState",
210
           "LatentMultigraphBlockState",
211
212
           "UncertainBlockState",
           "MeasuredBlockState",
213
           "UncertainBaseState",
214
           "MixedMeasuredBlockState",
Tiago Peixoto's avatar
Tiago Peixoto committed
215
           "DynamicsBlockStateBase",
216
           "EpidemicsBlockState",
Tiago Peixoto's avatar
Tiago Peixoto committed
217
           "IsingBaseBlockState",
218
219
220
221
           "IsingGlauberBlockState",
           "PseudoIsingBlockState",
           "CIsingGlauberBlockState",
           "PseudoCIsingBlockState",
222
223
224
           "LatentLayerBaseState",
           "LatentClosureBlockState",
           "MeasuredClosureBlockState",
225
           "HistState",
226
           "CliqueState",
Tiago Peixoto's avatar
Tiago Peixoto committed
227
228
229
230
231
232
           "MCMCState",
           "MultiflipMCMCState",
           "MultilevelMCMCState",
           "GibbsMCMCState",
           "MulticanonicalMCMCState",
           "ExhaustiveSweepState",
233
234
           "mcmc_equilibrate",
           "mcmc_anneal",
Tiago Peixoto's avatar
Tiago Peixoto committed
235
           "TemperingState",
236
237
           "multicanonical_equilibrate",
           "MulticanonicalState",
238
239
           "EMBlockState",
           "em_infer",
240
241
           "mf_entropy",
           "bethe_entropy",
242
           "microstate_entropy",
243
           "marginal_multigraph_entropy",
244
245
           "marginal_multigraph_sample",
           "marginal_graph_sample",
246
247
           "marginal_multigraph_lprob",
           "marginal_graph_lprob",
248
249
           "PartitionHist",
           "BlockPairHist",
250
251
           "half_edge_graph",
           "get_block_edge_gradient",
252
           "get_hierarchy_tree",
253
           "modularity",
254
255
           "latent_multigraph",
           "partition_overlap",
256
           "nested_partition_overlap",
257
           "contingency_graph",
Tiago Peixoto's avatar
Tiago Peixoto committed
258
259
           "contiguous_map",
           "nested_contiguous_map",
260
           "align_partition_labels",
261
262
           "align_nested_partition_labels",
           "shuffle_nested_partition_labels",
263
           "shuffle_partition_labels",
264
265
266
267
268
269
270
271
           "order_partition_labels",
           "order_nested_partition_labels",
           "partition_overlap_center",
           "nested_partition_overlap_center",
           "nested_partition_clear_null",
           "variation_information",
           "mutual_information",
           "reduced_mutual_information"]
272

Tiago Peixoto's avatar
Tiago Peixoto committed
273
from . base_states import *
274
275
276
277
from . blockmodel import *
from . overlap_blockmodel import *
from . layered_blockmodel import *
from . nested_blockmodel import *
278
from . uncertain_blockmodel import *
279
280
from . mcmc import *
from . minimize import *
281
from . blockmodel_em import *
282
from . util import *
283
from . modularity import *
284
from . norm_cut import *
285
from . latent_multigraph import *
Tiago Peixoto's avatar
Tiago Peixoto committed
286
from . partition_centroid import *
287
from . partition_modes import *
288
from . planted_partition import *
289
from . latent_layers import *
290
from . histogram import *
291
from . clique_decomposition import *