Closed pancodia closed 6 years ago
I found in the master branch, this is fixed. I installed the package via ˋpip install glmnet_pyˋ, I guess the pypi package is not updated with the latest master branch.
Thanks Pan. I will update soon.
On Wed, Dec 27, 2017 at 9:23 PM, Pan Chao notifications@github.com wrote:
I found in the master branch, this is fixed. I installed the package via ˋpip install glmnet_pyˋ, I guess the pypi package is not updated with the latest master branch.
— 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/20#issuecomment-354215896, or mute the thread https://github.com/notifications/unsubscribe-auth/AKpDE_r4Uwx3FNclf1vKxQOj4NKkr-Isks5tEvu7gaJpZM4RN2Ho .
hmmm, same thing happens here
Had the same issue. Resolved it by giving it foldids.
how fix pls
@raimishah
You can compile it from source into you python dist-package folder.
git clone https://github.com/bbalasub1/glmnet_python.git
cd glmnet_python
python setup.py install
Then it is fixed.
For anyone else compiling from source, just a helpful reminder that the
python setup.py install
will install python2 while
python3 setup.py install
will install for python3.
I just now confirmed that pip install glmnet_py
loads a cvglmnet.py
file with a scipy.floor(nobs/nfolds)
argument in line 260, whereas in the master (at line 261) it is int(scipy.floor(nobs/nfolds))
. So it seems that the pypi package has yet to be updated. The pip version did cause the error when I ran the sample code.
I am getting a similar issue regardless of whether I install the package using pip or from the source. I tried running it on my MacOS and remotely on a linux machine and I am getting the same error. I also tried manually editing the code and cast the scipy.floor(nobs/nfolds) to an integer, but this did not help either. The traceback is:
----> 2 cvglmnet(x=dset['X'], y=dset['Y'])
~/.local/lib64/python3.6/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])
/cluster/apps/python/3.6.1/x86_64/lib64/python3.6/site-packages/numpy/lib/shape_base.py in tile(A, reps) 912 c = c.reshape(-1, n).repeat(nrep, 0) 913 n //= dim_in --> 914 return c.reshape(shape_out)
TypeError: 'numpy.float64' object cannot be interpreted as an integer
While reproducing the example
in the following notebook
https://github.com/bbalasub1/glmnet_python/blob/master/test/glmnet_examples.ipynb
I ran into the following error:
It seems that in ˋma = scipy.tile(scipy.arange(nfolds), [1, scipy.floor(nobs/nfolds)])ˋ, ˋ scipy.floor(nobs/nfolds)ˋ should be cast to integer.