Tuesday 27 June 2023

What is the cause of "RuntimeWarning: invalid value encountered in matmul ret = a @ b" when using sklearn?

I encountered RuntimeWarning when using Ridge().fit(X_train, y_train) on a dataset where X_train.shape = (9440, 1900)

/Users/username/micromamba/envs/data-science/lib/python3.11/site-packages/sklearn/utils/extmath.py:189: RuntimeWarning: invalid value encountered in matmul
  ret = a @ b

When I reduce the size of dataset X_train.shape = (1000, 1900) the RuntimeWarning goes away.

What might be causing this warning and how can I avoid it? I made sure there are no np.nan, np.inf, and -np.inf.



from What is the cause of "RuntimeWarning: invalid value encountered in matmul ret = a @ b" when using sklearn?

No comments:

Post a Comment