-
Notifications
You must be signed in to change notification settings - Fork 9
FactorGraph supports any type of factors + runs specialized inference for ORFactors #122
FactorGraph supports any type of factors + runs specialized inference for ORFactors #122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First round of comments. Some main issues:
- Look into adding support for different temperatures
- Improve naming. Might be better to stick to parents/children instead of top/bottom, and explicitly use positive/incoming instead of just pos/inc.
- Move the function for computing maxes/argmaxes out as a reusable, standalone function.
- Should not support single parent case
- In general more comments would help
@StannisZhou thanks for your comments. The main points to discuss are
|
Codecov Report
@@ Coverage Diff @@
## master #122 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 8 10 +2
Lines 671 857 +186
==========================================
+ Hits 671 857 +186
Continue to review full report at Codecov.
|
@StannisZhou I have started a draftr or the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments. Will look at the message updates with different temperature part more carefully later.
One high-level comment is, one way to see how good our abstractions are is to think about how painful it would be in the future to add a new type of factor. This PR is definitely a bit painful. It would be helpful to make sure after this PR it would be much less painful. And important things to consider include minimizing the number of places we need to touch when adding new factors in the future (e.g. organizing wirings in a dictionary instead of separate enumerations), and isolate places that need updating to be non-disruptive to other parts of the codebase.
@StannisZhou the unit test now builds 2 factors graphs with Enumeration vs OR factors and compares both general vs specialized factor to variables message updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor comments. We can merge this after these comments are addressed!
Before merging, could you also check to make sure all the current examples (e.g. RBM, RCN, GMRF) still run fine? In the unit test only the ising model example is checked.
@StannisZhou with the recent changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after fixing the docstrings. Excited to have this merged!
In this PR we
fg/graph.py
factors/enumeration.py
andfactors/logical.py
.graph.py
.pass_OR_fac_to_var_messages
infactors/logical.py
) and compare it with the existing one for EnumerationFactors in the unit testtests/factors/test_or.py