BEHAVIOR: use subtraction in UnbinnedNLL - #574
Merged
Merged
Conversation
UnbinnedNLL implementation for NumPyUnbinnedNLL implementations
UnbinnedNLL implementationsUnbinnedNLL implementation
UnbinnedNLL implementationUnbinnedNLL
redeboer
force-pushed
the
ENH/nll-computation
branch
from
August 5, 2026 19:45
a83c1b6 to
983ecd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #565
⚙️ Enhancements
UnbinnedNLL.__call__now computesN * log(integral) - sum(log(data))instead of-sum(log(data / integral)), which is the formula its own docstring already documents. This drops the full normalized-likelihood temporary: roughly 1.5x faster at formula level on NumPy, and ~1.15x on the full estimator call, where the intensity evaluation dominates.❗ Behavioral changes
NaN.NaNinstead of converging on a physically meaningless minimum. This is not hypothetical — it broketest_optimize_all_parametersfor all four back-ends underScipyMinimizer.🖱️ Developer experience
benchmarks/unbinned_nll.pycompares the two formulations over NumPy, Numba, JAX, and TensorFlow. Each back-end is timed with its own warm-up and synchronisation (block_until_ready()for JAX,.numpy()for TensorFlow, a compilation call for Numba), so that the numbers are actually comparable, and every benchmark asserts its result against a NumPy reference.UnbinnedNLLestimator per back-end, so that the formula-level difference can be weighed against the intensity evaluation that dominates a real fit.prangeloops undernjit(parallel=True)instead of as array expressions, since that is where Numba is competitive at all.poe benchmarknow takes optional positional paths, so that a single file can be run in isolation instead of the wholebenchmarks/directory:benchmarks/expression.pyand the fit test model square their mixture coefficients, so that they are non-negative by construction.🔨 Maintenance
__mean_function,__sum_function, and__log_functionto__mean,__sum, and__log, and the localbare_intensitiestodata_intensities.Squash commit messages