Open cool-RR opened 4 years ago
I did some debugging and testing. Like you mentioned this happens at larger max_n
, as in the error message it also happens with max_n=10**7
. I tried remove different classes and I think the error seems to occur specifically for the Cubic class, for others not. If you follow the error precisely, you see that coeff, residuals, rank, s = np.linalg.lstsq(x, y, rcond=-1)
(here) we get an empty numpy vector for the residual for the Cubic case when max_n
is large, the reason being that the rank of x is too small (see the relevant numpy docs) and thus numpy gives one an empty array. I think you should be able to compute the residual doing something like np.linalg.norm(y - x @ coeff)
which would still work in this case, however, doing that give different residual from numpy.
Why this specifically happens for the Cubic case, I cannot tell you. I tried this also for another case that I made up and again for large max_n
specifically the Cubic case has this problem.
Did this get resolved? Seems like @lucasalavapena got to the bottom of it.
Running this code under Python 3.8 produced the following traceback. Note that it seems that
max_n=10**7
is related to this bug, because it didn't happen before I used that.