Skip to content

make empirical accuracy calculation more robust - #109

Merged
jbloom merged 1 commit into
masterfrom
compute-empirical-error-in-log-space
Oct 24, 2025
Merged

make empirical accuracy calculation more robust#109
jbloom merged 1 commit into
masterfrom
compute-empirical-error-in-log-space

Conversation

@jbloom

@jbloom jbloom commented Oct 24, 2025

Copy link
Copy Markdown
Member

This pull request addresses this issue, which was originally pointed out by @fc-jian.

The key point is that the computational of the empirical accuracy (consensus.empirical_accuracy) ran into numerical issues if the numbers were large as it involved computing very large numbers and then taking their logs. In #106, @fc-jian originally proposed using Stirling's approximation, and made a draft pull request #108 to fix that.

However, in looking more I discovered that the built-in python gammaln function is even a better way to do this. I also updated the docs to describe the new math being done.

This pull request therefore solves #106 and is in lieu of #108, as I think it is a better solution.

@fc-jian, thanks so much for noting and flagging all of this!

This pull request addresses [this issue](#106),
which was originally pointed out by @fc-jian.

The key point is that the computational of the empirical accuracy
(`consensus.empirical_accuracy`) ran into numerical issues if the
numbers were large as it involved computing very large numbers and
then taking their logs. In #106, @fc-jian originally proposed using
Stirling's approximation, and made a draft pull request #108 to fix that.

However, in looking more I discovered that the built-in python `gammaln`
function is even a better way to do this. I also updated the docs
to describe the new math being done.

This pull request therefore solves #106 and is in lieu of #108, as I
think it is a better solution.

@fc-jian, thanks so much for noting and flagging all of this!
@jbloom jbloom linked an issue Oct 24, 2025 that may be closed by this pull request
@jbloom
jbloom merged commit 17e38a9 into master Oct 24, 2025
1 check passed
@fc-jian

fc-jian commented Oct 24, 2025

Copy link
Copy Markdown

Thanks for the discussion and fixing. Sorry I am not familiar with the format requirements of this repo haha.

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

Successfully merging this pull request may close these issues.

Overflow during the estimation of empirical accuracy

2 participants