-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
interp in NumPy/SciPy #189
Comments
Thanks @oyamad - you are correct - this should be fixed. The alternative would be to use |
Hi @oyamad - I have opened a PR to change the scipy.interp to be directly used from numpy. See PR jstac/QuantEcon.lectures#90 This also needs to be updated in the solutions_py.ipynb. See issue jstac/QuantEcon.lectures#92. We should be able to close this issue soon. Also note: I ran a speed test for np.interp and scipy.interpolate.interp1d and found that np.interp was significantly faster. 8.31ms for interp and 38.4ms for interp1d (including initializing the function). If anyone is interested, see this gist: https://gist.github.com/lbui01/1e7f2bffeae8296a31e49727bb710ef4 |
@lbui01 Thanks, nice work. I guess the main difference is that Having a callable object (e.g., a function) is often more convenient. In fact you can see in this line
from the optimal growth lecture that I'm creating a callable using I looked at the relative performance as well, and, if you do want to make a callable, then |
In summary, if we want to make a callable I suggest we use |
Thanks @jstac, I see why |
This is a minor issue.
In the whole library,
interp
is imported as fromscipy
, and one of the lectures states "Linear interpolation is performed by SciPy’sinterp
function", but it is actually a function from NumPy (numpy.interp).Importing from
scipy
is fine because the__init__.py
in SciPy hasfrom numpy import *
. The problem is that if the user looks into SciPy for the documentation (as I did), it is not found there, but in NumPy.The text was updated successfully, but these errors were encountered: