-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Parser errors/warnings for new syntax are confusing #1940
Comments
Here are some possible alternatives for a few of the error/warning messages mentioned above: Current:
Suggestions:
Current: - `PARSER EXPECTED: ` I saw this in the context of a missing vertical bar, but I'm not sure if that's the only time this error is thrown. If it only pertains to the vertical bar then maybe replace with something like one of these Suggestions:
|
Regarding |
After the first argument whenever there's an lpdf, lpmf, lcdf, or lccdf. I could relax the syntax to make the '|' optionally a ',', but I've been
|
But can the parser identify when a | is missing and suggest it instead On Jul 4, 2016, at 8:54 PM, Bob Carpenter notifications@github.com wrote:
|
Yes, that's what I plan to do. It's already recognizing
|
How about “Expected a | separating the random variables from the parameters in ”? On Jul 4, 2016, at 10:38 PM, Bob Carpenter notifications@github.com wrote:
|
I'll +1 this issue as well if possible. I was going through the deprecation appendix in the latest stan doco and updating all _log functions to _lpdf calls, and had no idea that the |
Agreed. Those will both be fixed for the next release. The issue's flagged
here for the parser warning and in the manual issue for the manual.
|
@betanalpha That would be confusing because any of the arguments can be random variables and the first one isn't required to be a random variable. It's much more work to call out the specific function (I'd have to write a new rule for the case where someone forgets the vertical bar, then create a custom message for it, then have it fail after it's matched and reported an error.) What I went with produces this:
|
To be technical, variables on the right hand side of the bar aren’t On Aug 22, 2016, at 9:07 AM, Bob Carpenter notifications@github.com wrote:
|
Understood, but it's the "anymore" that's problematic. They are |
That’s not quite the argument. The semicolon is purely frequentist and is meant to avoid Instead the difference is in the definition and use of a random In other words, the interpretation of what is a random variable On Aug 22, 2016, at 11:03 AM, Bob Carpenter notifications@github.com wrote:
|
update error msg for , instead of | in prob funs, fixes #1940
Summary:
When playing around with the new syntax I found that the parser errors and warnings were not very informative. Well, they were informative enough for me because I already know the correct syntax and was intentionally trying to trigger the error messages, but I imagine they would pretty opaque to users. Example in Reproducible Steps, below.
Description:
See below in Reproducible Steps
The duplication problem is a duplicate isseu with #1946, where there are more cases to fix.
Reproducible Steps:
First put the following in
logistic.stan
then run
This gives the warning:
which is good (not one of the ones I found confusing), but why does it appear twice if
bernoulli_logit_log
is only used once in the Stan program? Is it because the samplingstatement
y ~ bernoulli_logit(theta)
is also used? Either way it's kind of weird.The stuff I found more confusing comes next, when trying to follow the suggestion in the warning. First I modify the
bernoulli_logit_log
line in generated quantities:and the error is
which just says that it expected
<probability function arguments>
. I assume that's trying to tell me that I forgot the vertical bar but that's not what the message says. Would it be possible to mention the vertical bar in the message? In addition, I used a function that doesn't exist (bernoulli_logit_lpdf
even though it's a mass function) but didn't get any error about that. So it seems to be giving me an error about using the wrong arguments to a function that doesn't exist.So next I use the vertical bar:
log_lik[n] = bernoulli_logit_lpdf(y[n] | theta);
and that gets rid of the mysterious
<probability function arguments>
and now I get the error aboutbernoulli_logit_lpdf
not existing:except it doesn't tell me that I just need to use
lpmf
instead oflpdf
. Would it be possible to detect that that someone is using a function that just has an incorrect suffix?Current Output:
The current output is given above in Reproducible Steps
Expected Output:
I think it would be helpful if:
just
<probability function arguments>
lpdf
instead oflpmf
or vice-versa resulted in a more informative messageindicating that the correct function just has a different suffix
Are there reasons I'm overlook why any of these would be difficult?
Additional Information:
Current Version:
v2.10.0
The text was updated successfully, but these errors were encountered: