has2k1 / scikit-misc

Miscellaneous tools for data analysis and scientific computing

Home Page:https://has2k1.github.io/scikit-misc/stable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different errors in local build vs official wheels

has2k1 opened this issue · comments

The official build fails to error out for the problematic input. In this case, the span is too small. If the confidence intervals are to be computed, you end up in what appears to be an infinite loop.

code

import numpy as np
from skmisc.loess import loess

x = np.arange(10)
y = np.array([1, 2, 3, 4, 4, 5, 6, 7, 8, 9])

xseq = np.array([3, 9])
xseq = np.linspace(3, 9, 80)

lo = loess(x[3:], y[3:], weights=None, span=2/3)
lo.fit()

prediction = lo.predict(xseq, stderror=True)
#ci = prediction.confidence(alpha=0.05)  # <-- creates infinite loop in official build
print(prediction)

Results

  1. Local build
----------------------------------------------------------------------
ValueError                           Traceback (most recent call last)
<ipython-input-16-5c0006fdf08b> in <module>()
      8 
      9 lo = loess(x[3:], y[3:], weights=None, span=2/3)
---> 10 lo.fit()
     11 
     12 prediction = lo.predict(xseq, stderror=True)

_loess.pyx in _loess.loess.fit (skmisc/loess/src/_loess.c:10688)()

ValueError: b'Chernobyl! trL>n 7\n'
  1. Official build
-------
Predicted values      : [ 4.          3.96490947  3.93558725  3.91203333  3.89424772  3.88223041
  3.87598141  3.87550072  3.88078834  3.89184426  3.90866848  3.93126102
  3.95962186  3.993751    4.03552457  4.08765838  4.14891925  4.2179929
  4.29356501  4.3743213   4.45894747  4.54612921  4.63455224  4.72290225
  4.80986494  4.89412602  4.9743712   5.05063291  5.12658228  5.20253165
  5.27848101  5.35443038  5.43037975  5.50632911  5.58227848  5.65822785
  5.73417722  5.81012658  5.88607595  5.96202532  6.03797468  6.11392405
  6.18987342  6.26582278  6.34177215  6.41772152  6.49367089  6.56962025
  6.64556962  6.72151899  6.79746835  6.87341772  6.94936709  7.02531646
  7.10126582  7.17721519  7.25316456  7.32911392  7.40506329  7.48101266
  7.55696203  7.63291139  7.70886076  7.78481013  7.86075949  7.93670886
  8.01265823  8.08860759  8.16455696  8.24050633  8.3164557   8.39240506
  8.46835443  8.5443038   8.62025316  8.69620253  8.7721519   8.84810127
  8.92405063  9.        ]

Predicted std error   : [ inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf
  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf
  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf
  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf
  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf  inf
  inf  inf  inf  inf  inf]

Residual scale        : inf
Degrees of freedom    : nan

The bad values for the standard error, residual scale and degrees of problems are likely
the mechanical cause of the infinite loop. The predicted values look reasonable given the
in put data, but should we trust them? stderror=False for the local build still errors out.

This is most likely caused by a difference in compiler versions and/or settings.