我正在尝试基于链接实现 PchipInterpolator:
http://docs.scipy.org/doc/scipy-0.14.0/reference/ generated/scipy.interpolate.PchipInterpolator.html http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.interpolate.PchipInterpolator.html
我正在使用的代码是:
x = np.arange(0, 10)
y = np.exp(-x/3.0)
set_interp = scipy.interpolate.PchipInterpolator( x, y, extrapolate=True )
我得到的错误是:
TypeError: __init__() got an unexpected keyword argument 'extrapolate'
所以,显然我的实施方式是错误的。我尝试了许多其他方法来实现推断,但都失败了。
PchipInterpolator
在0.14版本中被重构,那时它已经增长了extrapolate
关键词。
比较 0.13 版本的文档:http://docs.scipy.org/doc/scipy-0.13.0/reference/ generated/scipy.interpolate.PchipInterpolator.html http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.interpolate.PchipInterpolator.html
和版本 0.14:http://docs.scipy.org/doc/scipy-0.14.0/reference/ generated/scipy.interpolate.PchipInterpolator.html http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.interpolate.PchipInterpolator.html
(免责声明:我参与了该重构)
Scipy 0.13 已经很老了,最好考虑升级。
最新的 scipy 版本在一致性方面稍好一些interpolate
。其一,所有基于多项式的插值器(PPoly、BPoly、Pchip 和 Akima)都具有extrapolate
关键词。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)