Skip to content

Conversation

@tg12
Copy link

@tg12 tg12 commented Oct 18, 2025

Previously using histogram bin centers instead of the actual data to compute log-likelihood.
That made AIC/BIC comparisons meaningless because likelihood was based on aggregated counts, not raw observations.

Fixed so it now runs dist.logpdf() on the real data array.
AIC/BIC now reflect real statistical fit quality

The old code divided the standard deviation by sqrt(2π). That factor belongs to the Gaussian PDF normalization, not the variance itself.

Replaced with a proper weighted variance using bin frequencies as weights

Killed double-logging of log values in some branches.
Cleaned up weighting logic so weighted stats are always coherent.

Please check these changes carefully, I might have made a mistake.

@tg12
Copy link
Author

tg12 commented Oct 18, 2025

Figure_1

@cokelaer
Copy link
Owner

@tg12 looks great. Except the ruff stuff (see my comments) the rest looks good to me. would you mind remove it. I understand this is may be more powerful that pyproject, but I wish to keep the repo as simple as possible.
Once the PR is accepted, I will update the README to add a contributor section where I will add your contrib.

@tg12
Copy link
Author

tg12 commented Oct 19, 2025

Check you are satisfied with the changes. All tests pass. I want a second set of eyes on the math fixes. Ignore the ruff files if you want; they are only part of my development tooling. It is just a formatter and linter. If you are curious, it is here: https://github.com/astral-sh/ruff

@tg12
Copy link
Author

tg12 commented Oct 20, 2025

I think the reason its failing is because it needs a Python version bump.

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.

2 participants