r - 文件 ../MatrixOps/cholmod_sdmult.c 第 90 行处出现 Cholmod 错误 'X and/or Y have wrong dimensions'

标签 r glmnet

它只是报告:

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/

相关文章:

r - 将数据帧的新列分配给与其他数据帧匹配的值

r - 在 R 中调整 plotmo::plot_glmnet 的顶轴标题和标签图

r - glmnet R 包中 cv.glmnet 的 "Error in drop(y %*% rep(1, nc))"错误

glmnet - 使用 glmnet 进行变量选择

根据列名称的条件重命名列

r - 将前一行值乘以常数 R

r - 从 glmnet 中提取系数变量名称到 data.frame

r - glmnet 错误 (nulldev == 0) 停止 ("y is constant; gaussian glmnet fails at standardization step")

r - R 中 13 个行索引之间的欧氏距离的排列

c++ - 在 Rcpp(和 RcppArmadillo)中,如何检查 vec 是否包含复数?