Releases: vicariousinc/PGMax
v0.4.1
Highlights
- Fixing two minor issues when running BP with variable groups defined with different number of states by @antoine-dedieu in #144
Full Changelog: v0.4.0...v0.4.1
v0.4.0
Breaking changes
This release makes several major breaking changes to improve usability and efficiency of the package.
1. Interacting with variables through VarGroup
objects
We no longer refer to variables by names, but instead directly interact with VarGroup
objects. This change has several implications.
-
We no longer have a
Variable
class. Instead, we access individual variables by indexing intoVarGroup
objects. -
FactorGraph
can no longer be initialized with a dictionary of variable groups (as we no longer have names for variables). Instead, we initialize aFactorGraph
by
from pgmax import fgraph
fg = fgraph.FactorGraph(variable_groups=variable_groups)
where variable_groups
is either a VarGroup
or a list of VarGroup
s.
- We can directly construct
Factor
/FactorGroup
using individual variables, and have a unifiedadd_factors
interface for addingFactor
s andFactorGroup
s to theFactorGraph
.
For example, we can create a PairwiseFactorGroup
via:
from pgmax import fgroup
pairwise_factors = fgroup.PairwiseFactorGroup(
variables_for_factors=variables_for_factors,
log_potential_matrix=log_potential_matrix,
)
where variables_for_factors
is a list of list of individual variables. And we can add factors to a FactorGraph
fg
by
fg.add_factors(factors=factors)
where factors
can be individual Factor
, individual FactorGroup
, or a list of Factor
s and FactorGroup
s.
- We access LBP results by indexing with
VarGroup
. For example, after running BP, we can get the MAP decoding for theVarGroup
visible_variables
via
beliefs = bp.get_beliefs(bp_arrays)
map_states_visible = infer.decode_map_states(beliefs)[visible_variables]
2. Efficient construction of FactorGroup
We have implemented efficient construction of FactorGroup
. Going forward, we always recommend constructing FactorGroup
instead of individual Factor
.
3. Improved LBP interface
We first create the functions used to run BP with temperature T via
from pgmax import infer
bp = infer.BP(fg.bp_state, temperature=T)
where bp
contains functions that initialize or updates the arrays involved in LBP.
We can initialize bp_arrays
by
bp_arrays = bp.init()
apply log potentials, messages and evidence updates by
bp_arrays = bp.update(
bp_arrays=bp_arrays,
log_potentials_updates=log_potentials_updates,
ftov_msgs_updates=ftov_msgs_updates,
evidence_updates=evidence_updates,
)
and run bp for a certain number of iterations by
bp_arrays = bp.run_bp(bp_arrays, num_iters=num_iters, damping=damping)
Note that we can arbitrarily interleave bp.update
with bp.run_bp
, which allows flexible control over how we run LBP.
4. Improved high-level module organization
Now we have 5 main high-level modules, fgraph
for factor graphs, factor
for factors, vgroup
for variable groups, fgroup
for factor groups, and infer
for LBP.
Details of what has changed:
- Speed up the process of adding
Factors
and compiling wiring for aFactorGraph
by moving all the computations to theFactorGroup
level, by @antoine-dedieu in #129 - Speed up the process of computing log potentials + wiring for
FactorGroup
withnumba
, by @antoine-dedieu in #133 - Make the
BP
class behavior closer to JAX optimizers by @antoine-dedieu in #135 - Get rid of the
Variables
andCompositeVariableGroup
classes + of the variable names + adopt a simpler representation for variables + rely on numpy arrays to makeNDVarArray
efficient, by @antoine-dedieu in #136 - Overall module reorganization, by @antoine-dedieu in #140
Full Changelog: v0.3.0...v0.4.0
v0.3.0
Highlights
- Refactors to support adding different factor types with specialized inference procedures by @antoine-dedieu in #122
- Specialized logical AND/OR factors by @antoine-dedieu in #122 #126
- New example on 2D binary blind deconvolution by @antoine-dedieu in #127
New Contributors
- @antoine-dedieu made his first contribution in #122
Full Changelog: v0.2.3...v0.3.0
v0.2.3
What's Changed
- Links to blog post and companion paper; Documentation updates by @StannisZhou in #111
- Get rid of redundant array shape for log_potentials by @StannisZhou in #116
- Support python 3.9/3.10; Improve documentation for add_factor; Bump up version for new release by @StannisZhou in #120
Full Changelog: v0.2.2...v0.2.3
PGMax release v0.2.2
What's Changed
- Update README by @StannisZhou in #103
- RCN example by @shrinuKushagra in #96
- Add support for sum-product with temperature by @StannisZhou in #104
- Include Grid Markov Random Field example by @StannisZhou in #107
- Changes for blog post by @StannisZhou in #109
New Contributors
- @shrinuKushagra made their first contribution in #96
Full Changelog: v0.2.1...v0.2.2
First public release
What's Changed
- Bump versions for publishing by @StannisZhou in #63
- Example notebook with PMAP sampling of RBMs trained on MNIST digits by @StannisZhou in #80
- Use
functools.partial
instead ofjax.partial
by @StannisZhou in #83 - First pass for speeding up graph and evidence operations by @StannisZhou in #84
- Moving to a functional interface by @StannisZhou in #88
- Update README in preparation for making repo public by @StannisZhou in #89
- Pre commit ci test by @NishanthJKumar in #90
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #91
- Update dependency requirements to be less aggresive by @StannisZhou in #92
- adds codecov badge to README! by @NishanthJKumar in #94
- Fix GPU memory leak that came up in RCN example by @StannisZhou in #97
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #95
- Docs update by @NishanthJKumar in #98
- fixes bug where wrong conf.py path was specified by @NishanthJKumar in #99
- Rtd warning fix by @NishanthJKumar in #100
- includes minor changes to README and documentation by @NishanthJKumar in #101
- Bump up version; Fixes for docs by @StannisZhou in #102
Full Changelog: v0.2.0...v0.2.1
Internal release
Features
- Efficient and scalable max-product belief propagation using a fully flat representation
- A general factor graph interface that supports easy specification of PGMs with pairwise factors and higher-order factors based on explicit enumeration
- Mechanisms for evidence and message manipulation
- 3 example notebooks showcasing the functionalities of PGMax