-
Notifications
You must be signed in to change notification settings - Fork 33
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
Refactor rule matching #188
Conversation
Codecov Report
@@ Coverage Diff @@
## master #188 +/- ##
==========================================
- Coverage 86.59% 86.50% -0.09%
==========================================
Files 95 95
Lines 4400 4395 -5
==========================================
- Hits 3810 3802 -8
- Misses 590 593 +3
Continue to review full report at Codecov.
|
Looks good to me, however, I will leave the final judgment for merging this to @semihakbayrak. |
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.
Thanks @ThijsvdLaar for "Refactor rule matching" PR. I think it is a necessary extension and I am happy to see this functionality but to be honest I am not that knowledgable about inheritance in Julia and actually encountered several problems before. Nevertheless, as it passed unit tests, I think we can merge it.
This PR refactors
Message
matching for update rule inference. For future rules (e.g. for the planned CVI implementation), the outbound message type might not always be clear upon message rule inference. That is, a CVI node might defineMessage{FactorNode}
as outbound type, even though it really sends aMessage{GaussianMeanVariance}
upon execution.The PR introduces
<<
as a "parametric inheritance" operator, such that e.g.Message{Gaussian} << Message{FactorFunction}
, but!(Message{FactorFunction} << Message{Gaussian})
. Thematch()
function is then defined as a two-way parametric inheritance, such thatmatch(Ma, Mb) = (Ma << Mb) || (Mb << Ma)
.This implementation broadens and clarifies
match
functionality without impacting existing rule matching.