-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
why sometimes get "LInAlgError:Singular matrix" error? #67
Comments
Hi @YeoungJe , I'm not sure exactly what is causing the error withpppout being able to reproduce it myself- is it possible for you to share the data with me? Something that should "fix" the problem is setting |
Hi @YeoungJe I'm going to close this issue for now but please get in touch again if you are still having problems and we can try and help if you provide more information. |
I am having the exact same issue! @alejandroschuler any thoughts on this? |
I have the same problem! This seems to be due to the use of inappropriate parameters! Such as larger learning rates, smaller max depths, and so on. |
model = NGBClassifier(Base=default_tree_learner, Dist=Bernoulli,
Score=MLE, natural_gradient=True, verbose=False,n_estimators = 500)
Here is error
` 226 # fitting
--> 227 model.fit(train_arx,train_ary)
228 if return_proba :
229 predict_value = model.predict_proba(test_arx)
~/anaconda3/lib/python3.6/site-packages/ngboost/ngboost.py in fit(self, X, Y, X_val, Y_val, sample_weight, val_sample_weight, train_loss_monitor, val_loss_monitor, early_stopping_rounds)
119 loss_list += [train_loss_monitor(D, Y_batch)]
120 loss = loss_list[-1]
--> 121 grads = S.grad(D, Y_batch, natural=self.natural_gradient)
122
123 proj_grad = self.fit_base(X_batch, grads, sample_weight)
~/anaconda3/lib/python3.6/site-packages/ngboost/scores.py in grad(forecast, Y, natural)
13 grad = forecast.D_nll(Y)
14 if natural:
---> 15 grad = np.linalg.solve(fisher, grad)
16 return grad
17
<array_function internals> in solve(*args, **kwargs)
~/anaconda3/lib/python3.6/site-packages/numpy/linalg/linalg.py in solve(a, b)
401 signature = 'DD->D' if isComplexType(t) else 'dd->d'
402 extobj = get_linalg_error_extobj(_raise_linalgerror_singular)
--> 403 r = gufunc(a, b, signature=signature, extobj=extobj)
404
405 return wrap(r.astype(result_t, copy=False))
~/anaconda3/lib/python3.6/site-packages/numpy/linalg/linalg.py in _raise_linalgerror_singular(err, flag)
95
96 def _raise_linalgerror_singular(err, flag):
---> 97 raise LinAlgError("Singular matrix")
98
99 def _raise_linalgerror_nonposdef(err, flag):
LinAlgError: Singular matrix`
On the same data, sometimes works fine but sometimes occur errors. What should I do when this error occurs?
The text was updated successfully, but these errors were encountered: