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

Use Scientific type for probability values #8

Open
k0ral opened this issue Mar 3, 2019 · 3 comments
Open

Use Scientific type for probability values #8

k0ral opened this issue Mar 3, 2019 · 3 comments

Comments

@k0ral
Copy link

k0ral commented Mar 3, 2019

probable currently uses the Double type to manipulate probability values, which precision is bounded (up to 64 bits, unless I am mistaken).
What do you think about using the Scientific type instead, from the scientific package ? It supports arbitrary precision values and claims to be space efficient.

@alpmestan
Copy link
Owner

Hello again!

In the spirit of this comment, I suspect a better choice would be Log Double, but I haven't really measured how much the arbitrary precision and all the bells and whistles that come with Scientific cost in terms of performance. There's a performance/numerical stability/precision trade-off here. Perhaps in an ideal world (or patch :p) we could make that call at the use site and not in the library itself. Thoughts?

PS: haven't seen you in a long time before today, you should drop by #haskell-fr one of these days :-)

@k0ral
Copy link
Author

k0ral commented Mar 8, 2019

Haven't thought about it that much honestly, I just happen to be working on a project in which everything is stored as a Scientific, and I wish I could avoid losing precision when using probable, even though it's not that big a deal in my case.
I will try and write a couple of benchmarks, if/when time permits.

PS: yes I should :)

@alpmestan
Copy link
Owner

Well something useful would be to just abstract away the Double that we currently have into a type param. Then we could use Log Double, Scientific or just Double. Might require having a class that encompasses the operations we require on the "probability weight type".

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