-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Gradients/derivatives in econforge interpolators #1157
Conversation
Pablo says UC is for uniform grids and only worked previously due to a bug
Improvements I'd like to make:
|
This is great! Though, failing some build tests... |
Yes! The reason is that the current version of |
(Whether it actually works depends on interpolation.py)
Q: If you ask for the derivative exactly at a kink point (where the answer is in principle Or, are piecewise linear splines not allowed? |
I just checked, and it calculates derivatives 'backwards' (using the previous point). Consider the following example
It creates a piecewise linear function. The derivative at 1 is (0 from the left) or (1 from the right). The derivative at 2 is (1 from the left) or (2 from the right). And so on. Here is what I get:
So it's using left-differences.
Yes they are, and they are in fact the only thing I am using at the moment. I have not explored higher order splines. |
Hmmm, I guess that's better than |
But we would not want to go around blowing up our---or other people's---computers! |
@MridulS , @sbenthall , this PR relies on the latest release of Pablo's How do I reflect that in HARK's requirements? Is it a matter only of writing |
Yeah, that will make sure that HARK installed via github is depending on interpolation >= 2.2.2. But we need to make a new release to make sure if someone does |
Well the good thing is that none of the content currently in HARK depends on the buggy derivatives, those are only used by elements introduced in this PR. So even without a HARK release people won't be getting bugs from HARK. But when we do roll out these new features we have to enforce |
Codecov Report
@@ Coverage Diff @@
## master #1157 +/- ##
==========================================
+ Coverage 73.33% 73.58% +0.24%
==========================================
Files 72 72
Lines 11387 11465 +78
==========================================
+ Hits 8351 8436 +85
+ Misses 3036 3029 -7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Bleh. Current tests are failing in windows because How on earth do I handle that requirement... Edit: The requirement was accidental, Pablo has patched the issue. |
After Pablo's patch this is now ready to review. |
# Conflicts: # Documentation/CHANGELOG.md # HARK/econforgeinterp.py
@llorracc @sbenthall @alanlujan91, could anyone review this? It's ready to go |
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.
Great PR, left a few comments. Looking forward to implementing this on other models.
@alanlujan91 thanks for the great suggestions. The last couple of commits address them all. Don't merge this in yet, I think Chris wanted to chat about it first. |
@alanlujan91 approves and I've discussed @llorracc 's questions with him over email, so I'll go ahead and merge. Thanks everyone! |
This PR adds the capability to compute first-order derivatives of n-dimensional interpolators for my wrapper of
econforge.interpolation.py
.It works but:
econforge.interpolation.py
. The current version one gets throughpip
has a bug. See Documentation for derivatives EconForge/interpolation.py#94. This PR depends on the version ofeconforge.interpolation
currently in their master branch.