0

我正在使用 SIS R。我的数据是数字的,包括响应变量。它有 651 列。我对其进行了标准化并将其转换为矩阵形式。

图书馆(“SIS”)

model1 <- SIS(GTGTm, gGTym, family = "gaussian", penalty = "lasso",
              tune = "bic", nfolds = 10,perm = FALSE,varISIS= "cons",  nsis = 10,
              standardize = TRUE)

我的数据中没有任何 NA。但我收到以下错误消息。请帮忙!但是,它正在使用 as.matrix 创建空间,所以我不知道如何修复它。

GT = read.csv("train.csv")
GTy = read.csv("trainy.csv")

x <- as.matrix(GT[,])
y <- as.matrix(GTy[,])

With str(x)
 chr [1:129, 1:651] " 44" " 55" " 58" " 39" "100" " 85" " 38" " 58" " 80" ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:651] "Automotive.Industry" "Commercial.Vehicles" "Motorcycles" "SUVs" ...

model1 <- SIS(GTGTm, gGTym, family = "gaussian", 惩罚 = "lasso", + tune = "bic", nfolds = 10,perm = FALSE,varISIS = "cons", nsis = 10, + 标准化 = TRUE ) Iter 1,筛选:62 191 212 223 227 237 Iter 1,选择:191 212 227 glm.fit(cbind(ones, x[, index], x[, condind]), y, family = gaussian() 中的错误) : 'x' 中的 NA/NaN/Inf 另外:警告消息:在 storage.mode(x) <- "numeric" :强制引入的 NA

4

1 回答 1

0

我发现解决方案最好使用 data.matrix 而不是 as.matrix。

于 2019-06-10T00:34:58.447 回答