Skip to content
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

Cross Validation with CoxPH #1

Open
sethi7ik opened this issue Jul 18, 2018 · 0 comments
Open

Cross Validation with CoxPH #1

sethi7ik opened this issue Jul 18, 2018 · 0 comments

Comments

@sethi7ik
Copy link

While trying to run CV with CoxPH to identify optimal lambda, the following error occurred:

ValueError Traceback (most recent call last)
in ()
----> 1 cvfit = cvglmnet(x = x.copy(), y = y.copy(), ptype = 'partial-likelihood', nfolds = 20)

~/miniconda3/lib/python3.6/site-packages/glmnet_python/cvglmnet.py in cvglmnet(x, y, family, ptype, nfolds, foldid, parallel, keep, grouped, **options)
241
242 # main call to glmnet
--> 243 glmfit = glmnet(x = x, y = y, family = family, **options)
244
245 is_offset = glmfit['offset']

~/miniconda3/lib/python3.6/site-packages/glmnet_python/glmnet.py in glmnet(x, y, family, **options)
448 fit = elnet(x, is_sparse, irs, pcs, y, weights, offset, gtype, parm,
449 lempty, nvars, jd, vp, cl, ne, nx, nlam, flmin, ulam,
--> 450 thresh, isd, intr, maxit, family)
451 elif (family == 'binomial') or (family == 'multinomial'):
452 # call lognet

~/miniconda3/lib/python3.6/site-packages/glmnet_python/elnet.py in elnet(x, is_sparse, irs, pcs, y, weights, offset, gtype, parm, lempty, nvars, jd, vp, cl, ne, nx, nlam, flmin, ulam, thresh, isd, intr, maxit, family)
22 ybar = ybar/sum(weights)
23 print(ybar.shape, y.shape)
---> 24 nulldev = numpy.dot((y - ybar)**2, weights)
25 # ka
26 lst = ['covariance', 'naive']

ValueError: operands could not be broadcast together with shapes (4864,2) (2,1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant