-
Notifications
You must be signed in to change notification settings - Fork 37
Less surprising model return values #63
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
Codecov Report
@@ Coverage Diff @@
## master #63 +/- ##
==========================================
- Coverage 79.47% 79.42% -0.05%
==========================================
Files 13 13
Lines 843 841 -2
==========================================
- Hits 670 668 -2
Misses 173 173
Continue to review full report at Codecov.
|
|
I, as a quite innocent user, would expect a model to behave like a function, and to return the value of the last line, with a tilde having the same semantics as an assignment.
So the easiest thing would be to define the semantics of tildes to be equivalent to |
|
Ah, yes I guess that's even better! Yeah the main motivation for |
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.
Beautyful.
|
I resolved some merge conflicts. It seems some tests are still broken. |
|
I removed two |
|
OK, now only code coverage fails. |
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.
Nice work!
|
thanks @devmotion! |
As can be seen in #50 (comment), the output of
model()can be quite surprising if no return statements are specified in the model definition. One possible solution to the problem that is implemented in this PR is to always returnnothingas a fallback. An alternative would be to return theVarInfoobject as a fallback but that might be not completely user-friendly since it might not be clear how to handle or analyse it.Additionally, currently
logpis reset both in the default evaluation function and inrunmodel!, so basicallymodel(vi)andrunmodel!(vi)are doing the same thing currently apart from adjustingeval_num. I removed theresetlogp!statement in the evaluation function to allow for greater flexibility and removed therunmodel!function. Instead now one can callmodel()andmodel(vi)- withoutvia newVarInfoobject is created but otherwise they are doing exactly the same thing.