8
我有一個問題與glmnet中,我不斷收到錯誤消息套索錯誤glmnet NA/NaN的/ INF
"Error in elnet(x, is.sparse, ix, jx, y, weights, offset, type.gaussian, : NA/NaN/Inf in foreign function call (arg 5)
In addition: Warning message:
In elnet(x, is.sparse, ix, jx, y, weights, offset, type.gaussian, : NAs introduced by coercion"
下面我就可以複製與「IRIS的數據設置錯誤,但這裏是我的特殊數據簡化代碼:
vars <- as.matrix(ind.vars)
lasso <- glmnet(vars, y=cup98$TARGET_D, alpha=1)
這裏的東西,你可以很容易地重現:
data(iris)
attach(iris)
x <- as.matrix(data.frame(Sepal.Width, Petal.Length, Petal.Width, Species))
y <- Sepal.Length
lasso <- glmnet(x,y=y, alpha=1)
謝謝很多人!