april-tools / cirkit

a python framework to build, learn and reason about probabilistic circuits and tensor networks
https://cirkit-docs.readthedocs.io/en/latest/
GNU General Public License v3.0
71 stars 1 forks source link

Product partition function #189

Closed IrwinChay closed 8 months ago

IrwinChay commented 8 months ago

Added product partition function, support more-than-two product (so that reparam structured in a binary tree)

Modified binary.py and functional.py to support more-than-two product

Modified categorical.py to support partition function of the product of categorical layers (so Log-Sum-Exp is used instead of Log-Integ-Exp for categorical layers, but the code structure is still the same)

TODO: as a result of the design of symb_cfg, need to fetch num_input_units from the parameters in a clumsy way (in def get_integral() of prod_ef.py), should we re-structure symb_cfg to simplify this?

clean TODOs in def get_partial(), similar to the helper functions in def get_integral()

Could add tests for product partition function and more-than-two product, already tested locally