malucalle / selbal

selbal: selection of balances for microbial signatures
32 stars 15 forks source link

LOOCV with Selbal #12

Open Chiamh opened 4 years ago

Chiamh commented 4 years ago

Hello, I've been exploring the selbal package and it works for my dataset using the default parameters specified in the selbal.cv function.

However when I've tried to increase n.fold to match the number of my samples (thus mimicking LOOCV), it returns an error:

One or several classes are smaller than the number of folds.

Error in (function (n, y, method = c("LOOCV", "CV", "MCCV", "bootstrap"), : 'n' is too small

Are there parts of your code that I can tweak to do LOOCV with your package? Thanks!

UVic-omics commented 4 years ago

Hi @Chiamh !

Thank you for using selbal. You ask an interesting question. The fact is that for the cross - validation we use GenerateLearningsets from CMA package. There, we use the CV method, so you can use there the alternative "LOOCV".

https://github.com/UVic-omics/selbal/blob/master/R/Selbal_Functions.R (Line 794) I do not know if you will need another change in order to run correctly.