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)
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)