-
-
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
[WIP] Vector-valued interpolation in econforgeinterp
#1242
base: master
Are you sure you want to change the base?
Conversation
@alanlujan91 not sure how this interferes or interacts with your interpolation rework. Does that change the |
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #1242 +/- ##
==========================================
+ Coverage 73.29% 73.51% +0.21%
==========================================
Files 75 75
Lines 12535 12632 +97
==========================================
+ Hits 9188 9286 +98
+ Misses 3347 3346 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@Mv77 this is a great idea! No worries about my interpolation overhaul. I'll merge your changes and resolve any conflicts. The only changes I made to econforgeinterp was moving the file to a HARK.interpolation subdirectory. |
@Mv77, yes, this would be great! But I think a good preliminary starting point would be for you do a review of Alan's interpolation notebook to revise it in whatever ways might be appropriate (probably mainly just notation) to make it possible to seamlessly add an example (or examples) using your tool when your tool is in a usable state. That would also get you a bit more into his mindspace which might be useful as you go along. In particular, it is still frustrating to me that we have not figured out how to deal generically (using open source tools) with the "structured but warped" case. The different triangulation methods, and Gaussian Process Regression, I believe are enormously slower than an efficient "structured but warped" tool would be (in which there is a known affine mapping between quadrangles in the warped space and regular rectangles in the unwarped space. |
Derivatives and decay extrapolators now work :) |
@llorracc I'm not sure this relates to warped interpolation. @alanlujan91 just confirmed that his rework only interacts with I'd be happy to contribute to the warped interpolation discussion but I would not want to tie this PR to that goal. |
I've run into some strange potential bug in Don't merge in yet. |
Just to codify a point from our discussion today: I'd really love to find some framework that is designed to represent a function AND ITS DERIVATIVES at a point, all in a tidy bundle. So, for the consumption function, at point or in Python
and using the Envelope result that with corresponding python something like
Somehow I can't shake the suspicion that surely someone, somewhere, has developed some infrastructure for constructing objects like this, rather than simply representing each item as a completely standalone thing as in Mateo's example. (I know that, if you have an interpolating function that has already been constructed, there's a syntax for obtaining its derivatives at a point; the natural syntax for representing the values of these derivatives at given points, to be fed to the interpolator constructor, would be to set the values for each point using exactly the same syntax, and then instruct your interpolation constructor to use the points it has to construct a piecewise function using some specified method. For example, piecewise Hermite interpolators will generate a function that matches the inputs (in levels and derivatives) at the specified points.) |
econforgeinterp
(and all other interpolators in HARK) currently support interpolation of scalar valued functions,The current version of this PR makes this possible in the barebones
LinearFast
. I still need to adjust the extra-stuff: derivatives and decay-interpolation.Why do I think this would be useful?
In a model with, say, a 2-dimensional state space, we often will construct a bunch of interpolators for
vFunc(m,n)
,dvdmFunc(m,n)
,dvdnFunc(m,n)
,cFunc(m,n)
... over the same(m,n)
grids.Often, in the expectation step of backward induction, we will need to evaluate, say
$\mathbb{R}^2\rightarrow \mathbb{R^2}$ interpolator of
dvdmFunc(m,n)
,dvdnFunc(m,n)
in a bunch of points. We can do this with two different interpolators, one for each function. But this does the slow calculation of which indices and weights to use for interpolation twice for every point (once in each interpolator). If we instead had an(m,n) -> [dvdmFunc(m,n), dvdnFunc(m,n)]
the calculation of indices and weights would be done only once.