alashworth / test-issue-import

0 stars 0 forks source link

Stan replaces lpdf suffix with log #174

Open alashworth opened 5 years ago

alashworth commented 5 years ago

Issue by rayleigh Sunday Nov 19, 2017 at 01:04 GMT Originally opened as https://github.com/stan-dev/stan/issues/2439


Summary:

Stan replaces lpdf suffix for probability functions that aren't user defined.

Description:

In src/stan/lang/grammars/semantic_actions_def.cpp, Stan does the following:

https://github.com/stan-dev/stan/blob/b1493865a8df7d82b94984538aa2cea73d21e991/src/stan/lang/grammars/semantic_actions_def.cpp#L1938-L1943

Reproducible Steps:

std_normal_lpdf is a valid function in stan/math, but not std_normal_log. So, when I expose std_normal_lpdf in Stan and write the appropriate function-signature test for std_normal_lpdf, making the test header file will error out. If I look at the corresponding header file, std_normal_lpdf has been replaced with std_normal_log.

Current Output:

Any non-user defined lpdf function will be replaced with log.

Expected Output:

I expect that I can add probability functions with only the lpdf or lpmf version implemented.

Additional Information:

Current Version:

v2.17.0

alashworth commented 5 years ago

Comment by bob-carpenter Sunday Nov 19, 2017 at 01:35 GMT


For now, we're just requiring devs to support also the old _log form for ease of code generation until we remove that functionality in Stan 3. It's an ugly and roundabout workaround since the _log functions will just call the _lpdf functions under the hood.

It might be possible to fix the generator, but I keep expecting us to be able to get rid of all the _log stuff eventually.

alashworth commented 5 years ago

Comment by rayleigh Sunday Nov 19, 2017 at 04:56 GMT


Got it. Should I close this issue then?

alashworth commented 5 years ago

Comment by bob-carpenter Tuesday Nov 21, 2017 at 00:02 GMT


Please leave it open. Let's close it when we fix the problem you raised. The laborious workaround is only intended as a stopgap until the issue gets fixed.