BREAK: make parametrized functions pure - #579
Open
grayson-helmholz wants to merge 11 commits into
Open
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
redeboer
reviewed
Aug 7, 2026
redeboer
left a comment
Member
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'TensorWaves benchmark results'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.
| Benchmark suite | Current: b818ba1 | Previous: dadc908 | Ratio |
|---|---|---|---|
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-numpy] |
7.067198373578674 iter/sec (stddev: 0.0006566206798525118) |
15.653084369591935 iter/sec (stddev: 0.0008327728665216672) |
2.21 |
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-numba] |
6.950944860503677 iter/sec (stddev: 0.0007231228780639494) |
15.57675266668666 iter/sec (stddev: 0.00019544090300604612) |
2.24 |
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-tf] |
0.6204018518144632 iter/sec (stddev: 0.0031506456032551738) |
1.4336772024447277 iter/sec (stddev: 0.002264740294580996) |
2.31 |
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[original-numpy] |
29.237973075993775 iter/sec (stddev: 0.00029802421855302494) |
82.89554185733245 iter/sec (stddev: 0.00047803677168886747) |
2.84 |
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[optimized-numpy] |
37.661080405219295 iter/sec (stddev: 0.00022621010787575476) |
128.51191203721672 iter/sec (stddev: 0.00026220735978772406) |
3.41 |
benchmarks/unbinned_nll.py::test_unbinned_nll_estimator[numpy] |
124.35434985283246 iter/sec (stddev: 0.00009557364942604139) |
345.5347754466312 iter/sec (stddev: 0.00009775185162269724) |
2.78 |
benchmarks/unbinned_nll.py::test_unbinned_nll_estimator[numba] |
97.18704899505222 iter/sec (stddev: 0.0003010207023603398) |
547.3808519863164 iter/sec (stddev: 0.00008040495616927644) |
5.63 |
This comment was automatically generated by workflow using github-action-benchmark.
redeboer
force-pushed
the
BREAK/pure-parametrized-function
branch
from
September 1, 2026 08:58
b818ba1 to
d1955d7
Compare
redeboer
force-pushed
the
BREAK/pure-parametrized-function
branch
from
September 1, 2026 14:10
65e86f0 to
8481a7f
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 #568
ParametrizedFunctionis now pure: parameter values are passed to the evaluation itself instead of being stored on the function beforehand. A call can no longer affect a later call, which makes function objects thread-safe and safe to trace with JIT compilers such asjax.jit.ParametrizedFunction.__call__is now declared on the interface itself (it was previously only implemented on subclasses) and takes parameter values as an optional second positional argument. Values given at the call are merged with the defaults inparametersfor that evaluation only.There is no deprecation period:
update_parameters()is removed in the same release that introduces the pure API.ParametrizedFunction.update_parameters(new_parameters)__call__, or usewith_parameters()for a new function with different defaultsParametrizedFunction.__call__(data)ParametrizedFunction.__call__(data, parameters=None)ParametrizedFunction.with_parameters(parameters)(new)❗ Behavioral changes
ChiSquaredandUnbinnedNLLno longer mutate the function they wrap. Calling an estimator, or runningoptimize()over it, leaves the wrapped function'sparametersuntouched, so a function can now be reused after a fit instead of silently carrying the optimizer's last trial values.📝 Documentation
usage/basicspage, that aParametrizedFunctionis immutable and that there are two ways of using non-default parameter values: pass them to__call__for a single evaluation, or create a new function withwith_parameters(). Both are cheap, because the lambdified backend function is shared between the two.amplitude-analysispage are now computed with the optimized parameter values. They were computed with the model defaults before, because nothing ever wrote the fit result back intointensity_func. The rendered plot and the reported percentages change accordingly.🖱️ Developer experience
set_matplotlib_formats()frommatplotlib_inlineinstead of the%config InlineBackend.figure_formatsmagic, so the cells remain valid Python and can be formatted and linted like any other source file.Squash commit messages