-
Notifications
You must be signed in to change notification settings - Fork 93
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
Typer error when trying to run cvglmnet #6
Comments
Hi there, |
Hi,
Thanks! Can you change and do a merge request, and I will pull it into the
master?
Bala
…On Fri, Apr 14, 2017 at 10:15 PM, Yoel Sanchez Araujo < ***@***.***> wrote:
If I create some dummy data:
X = np.random.random((200,10)).astype(scipy.float64)
y = np.zeros(200)for i in range(0, 200, 2):
y[i] = 1
y = y.astype(scipy.float64)
then try running cvglment:
fit = cvglmnet(x = X, y = y, family = 'binomial')
I get:
---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-3-8dab0d126aa7> in <module>()----> 1 fit = cvglmnet(x = X, y = y, family = 'binomial')
2 #scipy.tile(scipy.arange(4), [1, scipy.floor(12/4.)])
/om/user/ysa/miniconda3/envs/py35/lib/python3.5/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))
/om/user/ysa/miniconda3/envs/py35/lib/python3.5/site-packages/numpy/lib/shape_base.py in tile(A, reps)
878 c = c.reshape(-1, n).repeat(nrep, 0)
879 n //= dim_in--> 880 return c.reshape(shape_out)
TypeError: 'numpy.float64' object cannot be interpreted as an integer
It seems the problem is in the line:
ma = scipy.tile(scipy.arange(nfolds), [1, scipy.floor(nobs/nfolds)])
If instead you change that to:
ma = scipy.tile(scipy.arange(nfolds), [1, int(scipy.floor(nobs/nfolds))])
The problem goes away.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKpDE49ogcNRmKpeHKt_3bjexz_scUtuks5rwChIgaJpZM4M-OTm>
.
|
Has this already been pulled into the master branch? I'm getting the same error. Thanks. |
I am having same error. Asked about it in Stack overflow: |
This seems to be specific to OS/version. I tried the same problem after a fresh install on Ubuntu/18.04 and could not reproduce it. |
I got the same error on Mac. |
If I create some dummy data:
then try running cvglment:
I get:
It seems the problem is in the line:
If instead you change that to:
The problem goes away.
The text was updated successfully, but these errors were encountered: