bbalasub1 / glmnet_python

GNU General Public License v3.0
199 stars 94 forks source link

Warning: Non-fatal error in glmnet library call: error code = -1 #49

Open Yikai-Wang opened 4 years ago

Yikai-Wang commented 4 years ago

Hi there, I am using your code to solve logistic regression using the code

N = 80
d = 5
C = 5
pfac = scipy.ones([d+N,C])
pfac[:d,:C]=0
x = np.random.randn(N,d)
i = np.eye(N)
x = np.concatenate([x,i],axis=1)
y = np.random.randint(0,5,size=[N,])
y = y.astype('float')
fit = glmnet(x = x.copy(), y = y.copy(), family = 'multinomial', mtype = 'grouped', penalty_factor=pfac)

The above code works on the synthesis data. However, when I use it in the my own x and y. It prints out:

Warning: Non-fatal error in glmnet library call: error code =
 -1
Check results for accuracy. Partial or no results returned.

which should be the code of https://github.com/bbalasub1/glmnet_python/blob/645deee574a4922a36e39830d2e6f68ac50765a0/glmnet_python/lognet.py#L225-L227 And send out the error of

ValueError: negative dimensions are not allowed

In https://github.com/bbalasub1/glmnet_python/blob/645deee574a4922a36e39830d2e6f68ac50765a0/glmnet_python/lognet.py#L275 The reason is that the calculated lmu=-1. I want to locate the bug but find it was computed in https://github.com/bbalasub1/glmnet_python/blob/645deee574a4922a36e39830d2e6f68ac50765a0/glmnet_python/lognet.py#L185-L216 I am not familiar with Fortran, so it is hard for me to find out the error. Could you help me?