Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

New Interface for Factor Graph Model Building #53

Merged
merged 12 commits into from
Aug 17, 2021
Merged

New Interface for Factor Graph Model Building #53

merged 12 commits into from
Aug 17, 2021

Conversation

NishanthJKumar
Copy link
Contributor

Initial implementation of new interface for model building!
(Currently, only evidence construction is new, but will add support for incremental factor adding and intuitive message initialization)

Resolves #52

@NishanthJKumar NishanthJKumar self-assigned this Aug 12, 2021
@NishanthJKumar NishanthJKumar changed the title No user subclass New Interface for Factor Graph Model Building Aug 12, 2021
Copy link
Contributor

@StannisZhou StannisZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't looked in detail, but maybe consider turning more things (wiring, evidence, etc.) into properties? You are already implementing getters/setters so might as well just use properties.....

Nishanth and others added 4 commits August 12, 2021 12:59
* simplifies sanity_check example by using new interface
* function now takes variable group index instead of VariableGroup
* uses 'FactorFactories' to add factors to a FactorGraph instead of directly making the user pass these in
* simplifies evidence construction for FactorGraphs
* updates docstrings
* updates sanity_check example to work with new interface
@NishanthJKumar
Copy link
Contributor Author

@StannisZhou : this update should contain everything we discussed relating to adding evidence and factors. Some things to look at in particular are the add_factors method in fg.py and the cell under the title Add FactorGroups to FactorGraph in examples/sanity_check.py to see an example of how this add_factors method is used. It seems just a little awkward to do this whole FactorFactory thing when we could just pass in FactorGroups directly, especially when we let users instantiate VariableGroups directly. Any thoughts or suggestions on this?

Nishanth added 3 commits August 13, 2021 14:22
* fairly ugly hack in graph/update_evidence: if the tuple is size 1 extracts the 0th element...
@NishanthJKumar
Copy link
Contributor Author

@StannisZhou : added E2E unit test! I'm a little bit worried the results of the test are not consistent (so try running it yourself on your personal machine to see if it still works). The test is basically a scaled down version of the sanity_check example, so once the code is changed and the sanity check example runs again, it should be straightforward to run the test.

Copy link
Contributor

@StannisZhou StannisZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some comments regarding some details and the interface. But overall looks pretty good!

@NishanthJKumar NishanthJKumar marked this pull request as ready for review August 13, 2021 20:58
Copy link
Contributor

@StannisZhou StannisZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some more comments. Mainly need to update the add_factors interface.

Copy link
Contributor

@StannisZhou StannisZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last remaining piece: add support for adding individual factors (without the requirement that things have to be wrapped in a list).

Copy link
Contributor

@StannisZhou StannisZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for addressing the comments!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make FactorGraph mutable to support interactive model building
2 participants