LOESS / LOWESS功能,可重复

时间:2018-12-14 18:55:50

标签: python regression statsmodels loess

我正在使用statsmodels最低平滑器(请参阅文档here)。

主要运行正常,但有时会产生错误:

/anaconda3/lib/python3.6/site-packages/statsmodels/nonparametric/smoothers_lowess.py:165:
RuntimeWarning: invalid value encountered in true_divide
res = _lowess(y, x, frac=frac, it=it, delta=delta)

/anaconda3/lib/python3.6/site-packages/numpy/lib/function_base.py:4011: RuntimeWarning: Invalid value encountered in median
r = func(a, **kwargs)

/anaconda3/lib/python3.6/site-packages/statsmodels/nonparametric/smoothers_lowess.py:165: RuntimeWarning: invalid value encountered in greater_equal
res = _lowess(y, x, frac=frac, it=it, delta=delta)

我发现,当输入包含许多重复项时,就会产生这些错误。

例如:

x = [1,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6,7]
y = [2,1,3,2,3,4,5,6,7,8,9,0,2,3,4,5,6,7,8,2,8,1]

lowess = sm.nonparametric.lowess(endog = x, exog = y, frac = 0.6666)

在这些情况下如何使用低贱?

谢谢!

0 个答案:

没有答案