【发布时间】:2018-05-14 14:02:01
【问题描述】:
我有插值功能:
from scipy import interpolate
def f(x):
x_points = [38508,38510,38512]
y_points = [0.249267578125,0.181396484375,0.1912841796875]
tck = interpolate.splrep(x_points, y_points,k=2,xb=38508,xe=38512)
return interpolate.splev(x, tck)
当我评估 f(38503) 时,输出是 0.75,这与 y_points 完全不同。
关于如何使用这种或其他插值方法减少此错误的任何建议?
【问题讨论】:
-
这不是插值,而是外推(您要求的点超出了训练集的范围)。你想减少什么“错误”?如果考虑 3 个输入点呈现的曲线,这是一个完全合理的曲线拟合结果。
标签: python math interpolation