New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lowess errror: RuntimeWarning: invalid value encountered in double_scalars #1540
Comments
Confirming issue also present in Biopython 1.70 and the current master branch (what would become Biopython 1.71). Also tested under older versions of Python and Numpy which does not seem to matter (as I would have expect). @mdehoon is this something you could advise on? |
In the referenced issue, the resolution was to return a flag value for this kind of bad input (something they already did in some cases): statsmodels/statsmodels@f28610e We currently only return another numpy array.... https://github.com/biopython/biopython/blob/biopython-170/Bio/Statistics/lowess.py#L38 |
Maybe a ZeroDivisionErrorException should be raised? |
I wonder if NumPy had good reason to use I suppose you can also give a more helpful error message with the more precise exception... |
I have the same problem. I've also encountered a warning when using BioPython's example dataset. It seems to produce the message with specific Script: # Example dataset from
# https://biopython.org/DIST/docs/api/Bio.Statistics.lowess-module.html
x = np.array([4, 4, 7, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12,
12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16,
17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20,
20, 22, 23, 24, 24, 24, 24, 25], np.float)
y = np.array([2, 10, 4, 22, 16, 10, 18, 26, 34, 17, 28, 14, 20, 24,
28, 26, 34, 34, 46, 26, 36, 60, 80, 20, 26, 54, 32, 40,
32, 40, 50, 42, 56, 76, 84, 36, 46, 68, 32, 48, 52, 56,
64, 66, 54, 70, 92, 93, 120, 85], np.float)
yest = lowess(x, y, f=0.1, iter=1) Warning:
Python: 3.6.9 |
I would suggest to use SciPy instead of Biopython for this. Also, in Biopython 1.76, Bio.Statistics is deprecated, so it may exist for much longer. |
Closed by #3341 |
Setup
I am reporting a problem with Biopython version, Python version, and operating
system as follows:
Statement
Here is a example:
and numpy will raise a warning:
it seems like determinant is
nan
in some cases.it is also discussed in statsmodels/statsmodels#1798
The text was updated successfully, but these errors were encountered: