alashworth / test-issue-import

0 stars 0 forks source link

classify functions for numerical instability #41

Open alashworth opened 5 years ago

alashworth commented 5 years ago

Issue by bob-carpenter Thursday Jul 24, 2014 at 19:22 GMT Originally opened as https://github.com/stan-dev/stan/issues/801


Flag naive implementations (like incomplete beta derivatives) in the manual.

Ideally, characterize at what points in the domain functions are stable for.

Make sure that iterative functions have finite bounds and throw exceptions if they don't converge.

alashworth commented 5 years ago

Comment by betanalpha Thursday Jul 24, 2014 at 20:33 GMT


Basically anything that used my fragile implementations of the hypergeometric functions, 3F2 and 2F1.

Some effort should go into testing my implementation for the gradients of the incomplete gamma, too,

alashworth commented 5 years ago

Comment by bob-carpenter Thursday Jul 24, 2014 at 21:51 GMT


I'd add

It'd be nice if we could make some of the functions better behaved on the log scale, because what we really need is log_cdf. The problem is that the derivatives involve 1/cdf, so unless things cancel, we're stuck having no more precision than for cdf itself in terms of gradients.

alashworth commented 5 years ago

Comment by aadler Thursday Jul 24, 2014 at 21:55 GMT


Michael, just in case you haven't seen these, they may prove helpful:

alashworth commented 5 years ago

Comment by betanalpha Friday Jul 25, 2014 at 08:10 GMT


It'd be nice if we could make some of the functions better behaved on the log scale, because what we really need is log_cdf. The problem is that the derivatives involve 1/cdf, so unless things cancel, we're stuck having no more precision than for cdf itself in terms of gradients.

Technically the gradients require grad(cdf) / cdc which is another one of those functions that really should be computed directly (a la the polygamma functions) if we wanted to be really robust.

The strategy would involve someone familiar with

a) Implementing recursion relations (most of these functions have nice analytic continuations) b) Computing asymptotic expansions or Taylor series (asymptotic expansions seem to be more efficient) c) Given a series for f(x) or 1 + f(x), finding a good series approximation to log(f(x)) or log(1 + f(x)). d) Pade approximants and rational functions for developing efficient approximations to ratios of functions.