Skip to content
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

Improve numerical stability #18

Open
mleseach opened this issue Dec 16, 2022 · 1 comment
Open

Improve numerical stability #18

mleseach opened this issue Dec 16, 2022 · 1 comment

Comments

@mleseach
Copy link

The numerical instability of integral arrays are well known, especially when all coefficients of the source array are positive.

This can be a problem especially when using Float32.

This is due to the fact that the integral table has coefficients of different magnitudes and their subtraction lead to numerical instability.

However a simple workaround to mitigate these disparities is to add a negative bias to the source array. In particular using the mean as a bias works quite well most of the time.

Here is a pluto notebook to illustrate the improvement of the numerical stability:
https://gist.github.com/mle-seach/04bb528455c941776c6084185e905666

Do you think this feature has a place in this package?

If so i can open a PR, however im not sure if i should change the current IntegralArray implementation or create a new type, nor if I should put a default bias like the mean.

@timholy
Copy link
Member

timholy commented Jan 21, 2024

Sorry, I only just noticed this now, and that gist is gone. But I think I "get the gist" anyway, and it's not a crazy idea. It would not have to be a separate type, as you'd only be changing internals and preserving the existing behavior (except for roundoff error).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants