Skip to content

Error while using Natural Gradient #384

Open
@MichaelVitali

Description

@MichaelVitali

Hi, I'm using NGBoost for a project and I've just installed the last versions of numpy, pandas. I already worked with the library and I never had problems; however now I'm encountering a problem with the natural gradient. I get the following error:

Traceback (most recent call last):
  File "/Users/michaelvitali/repos/predico/main.py", line 5, in <module>
    ngb_model.main()
    ~~~~~~~~~~~~~~^^
  File "/Users/michaelvitali/repos/predico/models/ngb_model.py", line 109, in main
    model.fit(X_train_sc, y_train_sc.flatten())
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/predico/lib/python3.13/site-packages/ngboost/ngboost.py", line 236, in fit
    grads = D.grad(Y_batch, natural=self.natural_gradient)
  File "/opt/anaconda3/envs/predico/lib/python3.13/site-packages/ngboost/scores.py", line 12, in grad
    grad = np.linalg.solve(metric, grad)
  File "/opt/anaconda3/envs/predico/lib/python3.13/site-packages/numpy/linalg/_linalg.py", line 410, in solve
    r = gufunc(a, b, signature=signature)
ValueError: solve: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (m,m),(m,n)->(m,n) (size 14400 is different from 2).

On the other side, when setting natural_gradient=False works.
Do you know how can I solve it?

Thank you in advance.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions