-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement linear extrapolation #94
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool. Had a brief look and leaving the note so I can see down the road what has changed from this point onwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thank you!!!
Just a tiny comment.
In this PR, I add capabilities to perform linear extrapolation.
In particular, I
map_coordinates
function that allows for linear extrapolation. (A discussion on the JAX repo implied that they would not integrate this feature)Closes #83
How it works
To extrapolate linearly, one has to adjust the function that computes weights and indices of the coordinate points. For the linear interpolation, the JAX code can be found here.
This implementation implicitly assumes that
coordinate
is in the domain (interpolation). For values outside of the domain (extrapolation), one has to adjust the first line towhere
input_size
corresponds to a dimension of the input shape. This leads to the same behavior for interpolation but assigns the correct indices and weights needed for linear extrapolation for coordinates outside the domain.