Skip to content
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 CubicHermiteInterp #1011

Merged
merged 8 commits into from
Oct 21, 2021
Merged

Conversation

alanlujan91
Copy link
Member

CubicHermiteInterp is a HARK compatible wrapper of scipy's CubicHermiteSpline

See notebook for discussion: https://github.com/alanlujan91/HARK/blob/scipyCubic/examples/Interpolation/CubicInterp.ipynb

Please ensure your pull request adheres to the following guidelines:

  • Tests for new functionality/models or Tests to reproduce the bug-fix in code.
  • Updated documentation of features that add new functionality.
  • Update CHANGELOG.md with major/minor changes.

CubicHermiteInterp is a HARK compatible wrapper of scipy's CubicHermiteSpline
@sbenthall
Copy link
Contributor

This is great work @alanlujan91 !

I would be in favor of this replacing HARK's current cubic interpolator.

What happens if you do that? Do the automated tests for the library still pass?
In particular, do these unit tests for the interpolated pass?
https://github.com/econ-ark/HARK/blob/master/HARK/tests/test_interpolation.py#L46

(There are other model tests that use the interpolator.)

I wonder if it's possible to streamline the HARK interpolator interface further, but that may be out of scope of this particular PR.

remove additional scipy features, for another PR
simple replace CubicInterp for CubicHermiteInterp to check tests
@codecov-commenter
Copy link

codecov-commenter commented May 27, 2021

Codecov Report

Merging #1011 (b51ea9e) into master (d59269d) will decrease coverage by 0.00%.
The diff coverage is 69.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1011      +/-   ##
==========================================
- Coverage   72.53%   72.53%   -0.01%     
==========================================
  Files          68       68              
  Lines       10298    10358      +60     
==========================================
+ Hits         7470     7513      +43     
- Misses       2828     2845      +17     
Impacted Files Coverage Δ
HARK/interpolation.py 42.52% <68.18%> (+0.99%) ⬆️
HARK/ConsumptionSaving/ConsIndShockModel.py 85.86% <100.00%> (+0.01%) ⬆️
HARK/tests/test_interpolation.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d59269d...b51ea9e. Read the comment docs.

@llorracc
Copy link
Collaborator

@mnwhite

Could you review this per our conversation? Basically either ask Alan to add the old interpolator as an option (easier) or describe to him the tests you'd like him to conduct to show that the new version is better in every respect (including the memory usage issue that you identified earlier).

@mnwhite
Copy link
Contributor

mnwhite commented Jun 14, 2021 via email

modifies CubicHermiteInterp to pass test_interpolation
@alanlujan91
Copy link
Member Author

What happens if you do that? Do the automated tests for the library still pass?
In particular, do these unit tests for the interpolated pass?
https://github.com/econ-ark/HARK/blob/master/HARK/tests/test_interpolation.py#L46

@sbenthall I have swapped out CubicInterp for CubicHermiteInterp in ConsIndShockModel.py and in test_interpolation.py. Locally it passes all tests, waiting to see if it passes remotely.

@sbenthall
Copy link
Contributor

Apologies for the slow review turnaround, @alanlujan91 .
I see there's a merge conflict on interpolation.py

Could you fix that merge conflict?

@mnwhite did you see any reason not to merge this PR?

@alanlujan91
Copy link
Member Author

Could you fix that merge conflict?

@sbenthall please see #1060. I think this is something that should be addressed on its own in a standalone PR. I will work on this but lmk if you have any suggestions.

@sbenthall
Copy link
Contributor

Ok, should this PR be closed because it has been superseded by #1060?

@llorracc llorracc merged commit b36b8f8 into econ-ark:master Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants