Open esheeep opened 5 months ago
Hi @esheeep, I tried validation = 'Mfold', nrepeat = 50
and it displayed the same error, so it is not restricted to small nrepeat, I tried the proposed change but without success. The bug persists, it doens't matter if I put loo or Mfold.
Hi all,
Some additional issues in my case, the bug persists for plsda validation="loo"
when there are 3 or more principal components and dist="max.dist"
, because when I select dist="centroids.dist"
or dist = "mahalanobis.dist"
is everything ok, of course, dist = "all"
also doesn't run properly.
Hi mixOmics team and users,
π Describe the bug: When run function
perf
on a plsda/ splsda object, this error might happen:This is from the step to return the number of optimal component according to the error rates and happens when there are more than one component has the same minimum error rates. This error happens when using LOOV (
validation = "loo
, with alwaysnrepeat = 1
) or Mfold withnrepeat < 3
and more often when the sample size is very small.π‘ Possible solution: Before another updated
mixOmics
comes out, here is my solution in case you also encounter it:perf
.perf.mixo_plsda
(line 740- end), copy.ncomp_opt[measure, ijk] = which(t(rowMeans(mat.error.rate[[measure_i]][[ijk]])) == min(t(rowMeans(mat.error.rate[[measure_i]][[ijk]]))))[1]
(just add a[1]
at the end of this line in the orginal code to avoid multiple replacement). Then run the new function.environment()
assures that the function will be able to call other hidden functions inmixOmics
by using the code:environment(mod_perf.mixo_plsda) <- asNamespace("mixOmics")
.run the function for your splsda or plsda object, e.g.
splsda.perf <- mod_perf.mixo_plsda(splsda, validation = "loo")
. And it should work now!Hope it helps!
Guan