Pytensor-native interpolation functions #1141
Merged
+327
−0
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.
Description
Adds a new file,
interpolation.py
. Objective is to match a useful subset ofscipy.interpolate
. So far I have 1d interpolation with different strategies. Example:Everything is composed of pytensor primitives, so it ought to compile to JAX/NUMBA without additional changes. It seems there are so bugs though, so they don't work yet. Specifically, NUMBA raises the following error:
And it also gives a warning about a missing Supervisor, which might or might not be related.
In addition to this more feature rich
interpolate1d
API, I also addedpt.interp
, which matches the numpy signature 1:1:I figure I'll also do a function that do polynomial interpolation (fit via least-squares). The holy grail here is BSplines, but how to do that is somewhat beyond me at the moment. I think just getting these simple methods into the library would be useful, then we can open issues to add more interesting methods.
Related Issue
Interpolated
not supported in JAX/Numba backends pymc#6838Checklist
Type of change
📚 Documentation preview 📚: https://pytensor--1141.org.readthedocs.build/en/1141/