-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
descriptive error messages for incomplete probability library calls #987
Comments
Is the idea that these enhanced error messages occur for any X when foo_X is requested, or only when X is one of the existing kinds (rng, lpdf, etc)? Phrased another way, would "normal_weird" warn me that the normal family doesn't support "_weird", or would it just give the current warning about unknown identifier? I think this ends up determining what information we'd need to store to produce these |
No reason to speculate about unknown suffixes. stanc3/src/middle/Stan_math_signatures.ml Lines 141 to 149 in 17dd97b
|
I'm not even sure if we'd need that, would
work? |
I think it makes sense to distinguish between a totally unknown distribution and "this distribution family is known but the specific suffix is not supported" but it depends on the exact phrasing of the new error message. |
That's probably better. We just need a list of known families and a list of known suffixes at that point. I don't think we need to explicitly construct the matrix of which suffixes are available for which families however, given those two lists and our existing list of available functions we can very quickly determine whether or not we are in this situation. roughly if (is_undefined ident) then
if (is_known_family (remove_suffix ident)) && (is_known_suffix (get_suffix ident)) then
(*special error*)
else
(* current error *) I'll have to look but I know we already have a lot of utilities for getting or removing the suffixes in the code |
True enough. It just seems that |
That's probably better. We just need a list of known families and a list of known suffixes at that point
Yeah, this was the intention of my original suggestion.
In psuedo-code something like
if ( !implemented(“family_suffix) )
if ( standard(“family_suffix”) )
error(“family_suffix has not yet been implemented”);
else
error(“The function signature family_suffix does not exist”); // or whatever the current error message is
There are many possibilities for expanding on the error message, for example using the request suffix to update to something more readable like “The CDF for the <family> family has not yet been implemented.”
The basic suffixes would be lpdf or lpmf, cdf, ccdf, and rng, and then perhaps also qf based on the current design-doc discussion. Fixing lpdf or lpmf based no whether the family is discrete or continuous might be a pain.
|
Description
Our probability-distribution functions come in familes, e.g.,
normal_X()
, whereX
can be any oflpdf
,lupdf
,cdf
,lcdf
,lccdf
,rng
. But not all probability distributions implement each expected probability function. When a user callsfoo_X
for a probability distributionfoo
that exists, butfoo_X
doesn't exist, we should have a more specific message informing them of that so they don't think they've made a typo or waste time looking in the doc.Motivation
Quoted from @betanalpha's comment stan-dev/design-docs#42 (comment):
The text was updated successfully, but these errors were encountered: