我试着用SciPy的平滑一元样条曲线
from scipy.interpolate import UnivariateSpline
spl = UnivariateSpline(x, y)
我得到了这个错误信息。在
/usr/lib/python3.5/site-packages/scipy/interpolate/fitpack2.py:222: UserWarning: The maximal number of iterations maxit (set to 20 by the program) allowed for finding a smoothing spline with fp=s has been reached: s too small. There is an approximation returned but the corresponding weighted sum of squared residuals does not satisfy the condition abs(fp-s)/s < tol. warnings.warn(message)
如何重新定义maxit参数?我在SciPy手册中找不到任何东西,除了它是类中的关键字scipy.odr.odr公司. 不过我运气不太好。在
您不能更改此参数,它在FITPACK代码中已被修复:
https://github.com/scipy/scipy/blob/master/scipy/interpolate/fitpack/curfit.f#L220
原则上,您可以修改Fortran源代码并重新编译scipy,但这几乎肯定不是您想要的。相反,您可以使用单变量pline(或sprep)的
s
参数来查看给定数据x
和y
是否有用。在顺便说一句,ODR与此无关。在
相关问题 更多 >
编程相关推荐