bbalasub1 / glmnet_python

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

cvglmnet is throwing error about float to integer but glmnet is working fine #44

Closed kputta closed 4 years ago

kputta commented 4 years ago

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

TypeError Traceback (most recent call last)

in 1 warnings.filterwarnings('ignore') ----> 2 cvfit = cvglmnet(x = X_train.head(10000).values, y = y_train.head(10000).values, ptype = 'mse', nfolds=10) 3 warnings.filterwarnings('default') ~/miniconda3/envs/SANS37/lib/python3.7/site-packages/glmnet_python/cvglmnet.py in cvglmnet(x, y, family, ptype, nfolds, foldid, parallel, keep, grouped, **options) 258 259 if len(foldid) == 0: --> 260 ma = scipy.tile(scipy.arange(nfolds), [1, scipy.floor(nobs/nfolds)]) 261 mb = scipy.arange(scipy.mod(nobs, nfolds)) 262 mb = scipy.reshape(mb, [1, mb.size]) ~/miniconda3/envs/SANS37/lib/python3.7/site-packages/numpy/lib/shape_base.py in tile(A, reps) 1241 c = c.reshape(-1, n).repeat(nrep, 0) 1242 n //= dim_in -> 1243 return c.reshape(shape_out) TypeError: 'numpy.float64' object cannot be interpreted as an integer could be due to python3.7?
bbalasub1 commented 4 years ago

Can you try switching the float64 to an int? Likely a numpy versioning issue. Pls report back if that does not fix it.

On Tuesday, December 3, 2019, Kaushik Putta notifications@github.com wrote:

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

TypeError Traceback (most recent call last) in 1 warnings.filterwarnings('ignore') ----> 2 cvfit = cvglmnet(x = X_train.head(10000).values, y = y_train.head(10000).values, ptype = 'mse', nfolds=10) 3 warnings.filterwarnings('default')

~/miniconda3/envs/SANS37/lib/python3.7/site-packages/glmnet_python/cvglmnet.py in cvglmnet(x, y, family, ptype, nfolds, foldid, parallel, keep, grouped, **options) 258 259 if len(foldid) == 0: --> 260 ma = scipy.tile(scipy.arange(nfolds), [1, scipy.floor(nobs/nfolds)]) 261 mb = scipy.arange(scipy.mod(nobs, nfolds)) 262 mb = scipy.reshape(mb, [1, mb.size])

~/miniconda3/envs/SANS37/lib/python3.7/site-packages/numpy/lib/shape_base.py in tile(A, reps) 1241 c = c.reshape(-1, n).repeat(nrep, 0) 1242 n //= dim_in -> 1243 return c.reshape(shape_out)

TypeError: 'numpy.float64' object cannot be interpreted as an integer

could be due to python3.7?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bbalasub1/glmnet_python/issues/44?email_source=notifications&email_token=ACVEGE5YOP453JSBPGNKKWTQW3D7PA5CNFSM4JU6V7UKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5ZZ65A, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVEGE7IYDS7XEXWNBDHKC3QW3D7PANCNFSM4JU6V7UA .

kputta commented 4 years ago

it works

nfolds = 10 nobs = 100

doesn't work: scipy.tile((scipy.arange((nfolds))), [1, (scipy.floor(nobs/nfolds))]) works: scipy.tile((scipy.arange((nfolds))), [1, int(scipy.floor(nobs/nfolds))])

bbalasub1 commented 4 years ago

For future reference:

I tried running the vignette with a fresh install using:

Python 3.6 Numpy 1.16.2 Gfortran/Gnu gcc 4.8.5

And it worked just fine.

On Tuesday, December 3, 2019, Balakumar Balasubramaniam bbalasub@gmail.com wrote:

Can you try switching the float64 to an int? Likely a numpy versioning issue. Pls report back if that does not fix it.

On Tuesday, December 3, 2019, Kaushik Putta notifications@github.com wrote:

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

TypeError Traceback (most recent call last) in 1 warnings.filterwarnings('ignore') ----> 2 cvfit = cvglmnet(x = X_train.head(10000).values, y = y_train.head(10000).values, ptype = 'mse', nfolds=10) 3 warnings.filterwarnings('default')

~/miniconda3/envs/SANS37/lib/python3.7/site-packages/glmnet_python/cvglmnet.py in cvglmnet(x, y, family, ptype, nfolds, foldid, parallel, keep, grouped, **options) 258 259 if len(foldid) == 0: --> 260 ma = scipy.tile(scipy.arange(nfolds), [1, scipy.floor(nobs/nfolds)]) 261 mb = scipy.arange(scipy.mod(nobs, nfolds)) 262 mb = scipy.reshape(mb, [1, mb.size])

~/miniconda3/envs/SANS37/lib/python3.7/site-packages/numpy/lib/shape_base.py in tile(A, reps) 1241 c = c.reshape(-1, n).repeat(nrep, 0) 1242 n //= dim_in -> 1243 return c.reshape(shape_out)

TypeError: 'numpy.float64' object cannot be interpreted as an integer

could be due to python3.7?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bbalasub1/glmnet_python/issues/44?email_source=notifications&email_token=ACVEGE5YOP453JSBPGNKKWTQW3D7PA5CNFSM4JU6V7UKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5ZZ65A, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVEGE7IYDS7XEXWNBDHKC3QW3D7PANCNFSM4JU6V7UA .

kputta commented 4 years ago

Thanks

Best, Kaushik

On Dec 3, 2019, at 5:20 PM, bbalasub1 notifications@github.com wrote:

For future reference:

I tried running the vignette with a fresh install using:

Python 3.6 Numpy 1.16.2 Gfortran/Gnu gcc 4.8.5

And it worked just fine.

On Tuesday, December 3, 2019, Balakumar Balasubramaniam bbalasub@gmail.com wrote:

Can you try switching the float64 to an int? Likely a numpy versioning issue. Pls report back if that does not fix it.

On Tuesday, December 3, 2019, Kaushik Putta notifications@github.com wrote:

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

TypeError Traceback (most recent call last) in 1 warnings.filterwarnings('ignore') ----> 2 cvfit = cvglmnet(x = X_train.head(10000).values, y = y_train.head(10000).values, ptype = 'mse', nfolds=10) 3 warnings.filterwarnings('default')

~/miniconda3/envs/SANS37/lib/python3.7/site-packages/glmnet_python/cvglmnet.py in cvglmnet(x, y, family, ptype, nfolds, foldid, parallel, keep, grouped, **options) 258 259 if len(foldid) == 0: --> 260 ma = scipy.tile(scipy.arange(nfolds), [1, scipy.floor(nobs/nfolds)]) 261 mb = scipy.arange(scipy.mod(nobs, nfolds)) 262 mb = scipy.reshape(mb, [1, mb.size])

~/miniconda3/envs/SANS37/lib/python3.7/site-packages/numpy/lib/shape_base.py in tile(A, reps) 1241 c = c.reshape(-1, n).repeat(nrep, 0) 1242 n //= dim_in -> 1243 return c.reshape(shape_out)

TypeError: 'numpy.float64' object cannot be interpreted as an integer

could be due to python3.7?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bbalasub1/glmnet_python/issues/44?email_source=notifications&email_token=ACVEGE5YOP453JSBPGNKKWTQW3D7PA5CNFSM4JU6V7UKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5ZZ65A, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVEGE7IYDS7XEXWNBDHKC3QW3D7PANCNFSM4JU6V7UA .

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.