I get the aforementioned error although I check that I have no missing or infinite values when trying to do linear regression with np.linalg.lstsq...Any thoughts? I do these regressions recursively and I printed the shape of X and Y and are always same but it raises the error in a specific iteration
---> 17 betas = np.linalg.lstsq(X,Y,rcond=None)[0]
18
19 res = Y - X.dot(betas)
<__array_function__ internals> in lstsq(*args, **kwargs)
~\anaconda3\lib\site-packages\numpy\linalg\linalg.py in lstsq(a, b, rcond)
2257 # lapack can't handle n_rhs = 0 - so allocate the array one larger in that axis
2258 b = zeros(b.shape[:-2] + (m, n_rhs + 1), dtype=b.dtype)
-> 2259 x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
2260 if m == 0:
2261 x[...] = 0
~\anaconda3\lib\site-packages\numpy\linalg\linalg.py in _raise_linalgerror_lstsq(err, flag)
107
108 def _raise_linalgerror_lstsq(err, flag):
--> 109 raise LinAlgError("SVD did not converge in Linear Least Squares")
110
111 def get_linalg_error_extobj(callback):
LinAlgError: SVD did not converge in Linear Least Squares