You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐞 Describe the bug:
When running the perf() function on a pls object (using any PLS mode), if there are features which have near zero variance (nzv), the following error is raised:
Error in Ypred[omit, , h] <- Y.hat[, , 1] : number of items to replace is not a multiple of replacement length
library(mixOmics)
data("liver.toxicity")
# reducing number of features to reduce run timeX<-liver.toxicity$gene[, 1:1000]
Y<-liver.toxicity$clinic# to reproduce error, we need to induce some features to have near zero varianceX[, c(1, 23, 62, 234, 789)] <-0pls.obg<- pls(Y, X, ncomp=4)
#> Warning in cor(A[[k]], variates.A[[k]]): the standard deviation is zeropls.perf.obj<- perf(pls.obg, validation="Mfold", folds=4,
progressBar=F,
nrepeat=3)
#> Error in Ypred[omit, , h] <- Y.hat[, , 1]: number of items to replace is not a multiple of replacement length
🤔 Expected behavior:
The perf() function is built to handle nzv features. Hence, it should ideally raise a warning to the fact that features have nzv, but should be able to proceed properly.
💡 Possible solution:
Error is occurring at line 542. Likely a result of Y.pred containing columns for every feature whereas Y.hat containing columns for all non-nzv features. Hence, adjusting this line to:
Ypred[omit, nzv.Y, h] = Y.hat[, , 1]
may solve the bug.
The text was updated successfully, but these errors were encountered:
🐞 Describe the bug:
When running the
perf()
function on apls
object (using any PLS mode), if there are features which have near zero variance (nzv), the following error is raised:Error in Ypred[omit, , h] <- Y.hat[, , 1] :
number of items to replace is not a multiple of replacement length
This pub was raised by two users on the discourse forum:
https://mixomics-users.discourse.group/t/pls-and-diablo-tuning/742/4
🔍 reprex results from reproducible example including sessioninfo():
Created on 2022-03-28 by the reprex package (v2.0.1)
Session info
🤔 Expected behavior:
The
perf()
function is built to handle nzv features. Hence, it should ideally raise a warning to the fact that features have nzv, but should be able to proceed properly.💡 Possible solution:
Error is occurring at line 542. Likely a result of
Y.pred
containing columns for every feature whereasY.hat
containing columns for all non-nzv features. Hence, adjusting this line to:Ypred[omit, nzv.Y, h] = Y.hat[, , 1]
may solve the bug.
The text was updated successfully, but these errors were encountered: