-
Notifications
You must be signed in to change notification settings - Fork 14
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
Ux rule suggestions #423
base: main
Are you sure you want to change the base?
Ux rule suggestions #423
Conversation
After a discussion in the RxInfer meeting today, we decided that the RuleMethodError was fine and that we will add a point to the bullet list in 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.
A couple of comments here:
- Tests were actually failing, but due to another bug in the previous code in
get_messages_from_rule_method
, that returns"μ(a) :: BayesBase.PointMass}"
(yes with this strange}
at the end). The code for extracting those is old and perhaps should be rewritten entirely. But for now I modified the tests a bit. - The suggestion in the PR are incomplete because it doesn't show rules that include marginals, we have a separate function
get_marginals_from_rule_method
for this purpose. - Simply including marginals from
get_marginals_from_rule_method
wouldn't be entirely correct though, because the order matters, e.g rule that acceptsq(a)::Something, μ(b)::Something
andμ(b):: Something, q(a)::Something
are two different rules, but perhaps we may skip it for now and just show first marginals and then messages? - Small comment, the rules use
q_a
while the error suggestsq(a)
. WDYT about this discrepancy?
for node_rule in this_node_rules | ||
node_name = get_node_from_rule_method(node_rule) | ||
node_inputs = get_messages_from_rule_method(node_rule) | ||
if typeof(node_inputs) !== Vector{Any} |
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.
Why do we need this check?
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.
get_messages_from_rule_method(node_rule)
will return Any[]
on an empty list (see rule.jl#1297).
For example:
> all_rules = methods(ReactiveMP.rule)
> this_node_rules = all_rules[ReactiveMP.get_node_from_rule_method.(all_rules) .== "MvNormalMeanVariance"]
> ReactiveMP.get_messages_from_rule_method(this_node_rules[1])
Without the type check, this snippet would print a rule for an Any
type (which doesn't exist).
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, perhaps then we should use !isempty(node_inputs)
?
Well, the intention of this functionality is to give the user advice on how to specify their model. For example, if they specify a
Yes. We could add "Note that the order of input arguments matters".
I thought about catching this and reverting it. But the goal of this error info is to advise the user to re-specify their model. If they re-define their node, then ReactiveMP will operate on |
Ah, you're right. I see. Yes, it will work for this case, but not for all. For instance, while the |
Ah ok. Then I will convert it back to draft and think of a solution. |
We can also brain-storm together in the office. The proposed changes are also fine for me since its definitely better than the current state :) |
I have added a rule lookup with the
RuleMethodError
to print the list of existing rules, with a corresponding test as part of therule_method_error
testset.The inference procedure
now returns:
I am happy with this result but I noticed that there is a clash with a functional form constrain error now:
So, this existing rule look may also need to be implemented in there. What do you think?
fixes #397