-
Notifications
You must be signed in to change notification settings - Fork 14
Support of message passing for Boolean functions #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This PR misses a nice demo demonstrating these functions' applicability. Once the demo is finished, we can promote this PR. |
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 draft of the PR looks good! There are some style issues that need to be tackled and some technical parts, such as:
- It would be cool if all these operations could have type aliases, such as
AND->&according to the normal Julia syntax. Not sure how elaborate the required changes will be, but in my opinion required before merging. - The
NOTnode now has interfacesoutandin1. This latter one implies that there is another input. I would recommend renaming it toin(and also in the tests/rules). - In some cases I can image users wanting to use these rules with data variables, I would recommend adding additional rules for
Pointmassdistributions. - I think we need to extend the
Contingencyobject to include normalization and labels. - I would like to double check the derivations towards the inputs of the
ANDandORnode on the whiteboard as these are quite tricky and as I ended up with different results. - I did not check the
Implicationnode as I am not sure what it does.
src/nodes/implication.jl
Outdated
|
|
||
| struct IMPL end | ||
|
|
||
| @node IMPL Deterministic [out, in1, in2] |
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.
What is an implication node? As a user I would not know what it does so it either requires: 1) docstrings/documentation or 2) a name change.
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.
I think @bartvanerp's comment is critical and should be addressed. A possible fix would include the truth tables for all logical operations.
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.
Perhaps good to add docstrings for every node. The implication is as "famous" as OR or AND operators.
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.
Ah I see that is quite common apparently. Could we use the abbreviation IMPLY instead according to https://en.wikipedia.org/wiki/Logical_connective?
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.
@Chengfeng-Jia, what is your opinion on renaming the node?
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.
I think IMPLY may be a proper name. Besides, if we decide to use & instead of AND, can we use
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.
For the Pointmass part, thanks for @bartvanerp explain. I wonder if Pointmass can be regarded as a special case of Bernoulli distribution. For example,
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.
Amazing effort, I agree with the comments by @bartvanerp Most importantly, the Contingency should indeed be normalized, since it represents a joint distribution over connected variables. It agree that it would be nice to write out the derivations in full, for checking, later reference, and most importantly, it can make for an impressive appendix in your thesis.
|
We need to add some sort of example to the documentation Examples section (and |
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
@bartvanerp @bvdmitri @Chengfeng-Jia I've added the demo demonstrating the usage of these nodes. |
Codecov Report
@@ Coverage Diff @@
## master #170 +/- ##
==========================================
+ Coverage 76.67% 76.76% +0.08%
==========================================
Files 183 196 +13
Lines 6569 6594 +25
==========================================
+ Hits 5037 5062 +25
Misses 1532 1532
Continue to review full report at Codecov.
|
|
Thanks @albertpod , @Chengfeng-Jia and @Sepideh-Adamiat . I'm fine with the current state of the PR. Once tests are passed we can merge. |
|
After adding docstrings with truth tables I think this PR should be ready for merge |
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.
Great work @albertpod , @Chengfeng-Jia and @Sepideh-Adamiat ! That is very good addition to our framework.
test/nodes/test_implication.jl
Outdated
| @@ -0,0 +1,20 @@ | |||
| module OrNodeTest | |||
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.
| module OrNodeTest | |
| module ImplicationNodeTest |
src/nodes/not.jl
Outdated
|
|
||
| struct NOT end | ||
|
|
||
| @node NOT Deterministic [out, in1] |
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.
Tests fail because they expect to see :in :)
| @node NOT Deterministic [out, in1] | |
| @node NOT Deterministic [out, in] |
This change also requires to fix all rules from :in1 to :in
This PR addresses issue #120.
Thanks to @Chengfeng-Jia and @Sepideh-Adamiat for deriving rules.