You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
numpy_ml.linear_model.LinearRegression.predict() generates ValueError when used with copy-pasted code, but pip installed version works as expected!! #77
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
Python version: 3.7.12
NumPy version: 1.21.5
(environment is Google Colab on 20-Mar, 2022.)
Describe the current behavior
I have copy-pasted the code for numpy_ml.linear_model.LinearRegression from github and did .fit() and .predict() on some dummy data. I got ValueError on .predict() like this:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[<ipython-input-10-4be896198177>](https://localhost:8080/#) in <module>()
----> 1 npml_lin_reg2_preds = npml_lin_reg2.predict(X_val)
2 npml_lin_reg2_preds[:10]
[<ipython-input-8-fc521849e158>](https://localhost:8080/#) in predict(self, X)
206 if self.fit_intercept:
207 X = np.c_[np.ones(X.shape[0]), X]
--> 208 return X @ self.beta
ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 1 is different from 11)
Describe the expected behavior
Expected behaviour is that .predict() doesn't generate ValueError.