Skip to content

numpy_ml.linear_model.LinearRegression.predict() generates ValueError when used with copy-pasted code, but pip installed version works as expected!! #77

@naveenmarthala

Description

@naveenmarthala

System information

  • 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.

Code to reproduce the issue
not code, here is the link to the notebook: https://colab.research.google.com/drive/12q9r2j4-UpUrPnzvMiPC6rxafa73cY5L?usp=sharing

Other info / logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions