它只是报告:
Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90.
我不知道为什么。
x.m <- data.matrix(train[,c(1:43)])
x.m [is.na(x.m)] <- 0
y.m <- train$NPL
cv.m <-data.matrix(cv)
set.seed(356)
cvfit.m.lasso = cv.glmnet(x.m, y.m,
family = "binomial",
alpha = 1,
type.measure = "class")
par(mfrow=c(1,2))
plot(cvfit.m.lasso, main = "Lasso")
coef(cvfit.m.lasso, s = "lambda.min")
predTrain.M = predict(cvfit.m.lasso, newx=cv.m, type="class")
table(cv$NPL, predTrain.M)
最佳答案
现在我的问题已经解决了。这是因为我忘记从测试数据中删除我的 Target 变量,这就是我收到此错误的原因。
关于r - 文件 ../MatrixOps/cholmod_sdmult.c 第 90 行处出现 Cholmod 错误 'X and/or Y have wrong dimensions',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49774312/