glmnet错误“ lognet(x,is.sparse,ix,jx,y,权重,偏移量,alpha,nobs,:(list)对象不能强制输入'double'类型错误”)

时间:2019-04-08 04:49:23

标签: r regression glmnet

My data

我在为数据运行逻辑回归时遇到问题,首先我在r中使用了glm函数,但收到以下警告:

Warning message:
glm.fit: fitted probabilities numerically 0 or 1 occurred

现在我正尝试做glmnet,因为数据非常稀疏:

x = data[, 2:27]
y = data[, 1]
y = as.matrix(y)

fit = glmnet(x, y, family = "binomial")

但是出现以下我不理解的错误:

Error in lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs,  : 
  (list) object cannot be coerced to type 'double'

0 个答案:

没有答案