biglasso icon indicating copy to clipboard operation
biglasso copied to clipboard

row.idx doesn't work ?

Open Freequilibrium opened this issue 3 years ago • 0 comments

I try to split X,y by row.idx parameter in biglasso and cv.biglasso however when row.idx is been used, cv.biglasso will return error massage "錯誤發生在 E[cv.ind == i, 1:res$nl] <- res$loss: 被替換的項目不是替換值長度的倍數" sorry for chinese version massage, this massage more likely indicate that two lengths "E[cv.ind == i, 1:res$nl]" and "res$loss" are different

code

library(biglasso)

data("colon")

X <- as.big.matrix(colon$X)
y <- rnorm(62, mean=50)

tr.ind <- sample(length(y), length(y)*0.85, replace = FALSE)
tt.ind <- seq_len(length(y))[-tr.ind]

## With Error massage after cv.biglasso
mdl <- biglasso(X,y,row.idx = tr.ind, penalty = "lasso", family = "gaussian")
cv.mdl <- cv.biglasso(X,y,row.idx = tr.ind, nfolds = 10, penalty = "lasso", family = "gaussian")

## Without Error massage after cv.biglasso
tr.X <- as.big.matrix(colon$X[tr.ind,])
tt.X <- as.big.matrix(colon$X[-tr.ind,])

tr.mdl <- biglasso(tr.X, y[tr.ind], penalty = "lasso", family = "gaussian")
cv.tr.mdl <- cv.biglasso(tr.X,y[tr.ind], nfolds = 10, penalty = "lasso", family = "gaussian")

session info

R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=zh_TW.UTF-8       LC_NUMERIC=C               LC_TIME=zh_TW.UTF-8        LC_COLLATE=zh_TW.UTF-8     LC_MONETARY=zh_TW.UTF-8   
 [6] LC_MESSAGES=zh_TW.UTF-8    LC_PAPER=zh_TW.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=zh_TW.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] biglasso_1.4.1   ncvreg_3.13.0    Matrix_1.3-4     bigmemory_4.5.36

loaded via a namespace (and not attached):
[1] bigmemory.sri_0.1.3 compiler_4.1.1      parallel_4.1.1      tools_4.1.1         Rcpp_1.0.7          grid_4.1.1          lattice_0.20-45    

Freequilibrium avatar Nov 01 '21 05:11 Freequilibrium