Vignette 5.8.5 - Error?

Hi there,

For section 5.8.5 ( tuning parameters and numerical outputs), I’ve ran into an issue in that this section of code:

MyResult.pls <- pls(X,Y, ncomp = 4)  
set.seed(30) # for reproducbility in this vignette, otherwise increase nrepeat
perf.pls <- perf(MyResult.pls, validation = "Mfold", folds = 5,
                  progressBar = FALSE, nrepeat = 10)
plot(perf.pls$Q2.total)
abline(h = 0.0975)

returns the errors:

1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf

I’ve had a look at the outputs of perf and realised that the desired output is in perf.pls$measures$Q2.total - however attempts to plot this have not worked similarly to the output in the vignette.

Is there a change to the code which will allow for similar output?

Hope the team is well, take care.

In the same section:

list.keepX <- c(2:10, 15, 20)
# tuning based on MAE
set.seed(30) # for reproducbility in this vignette, otherwise increase nrepeat
tune.spls.MAE <- tune.spls(X, Y, ncomp = 3,
                           test.keepX = list.keepX,
                           validation = "Mfold", folds = 5,
                           nrepeat = 10, progressBar = FALSE,
                           measure = 'MAE')
plot(tune.spls.MAE, legend.position = 'topright')

returns the error:

Error in match.arg(measure, choices = c("cor", "RSS")) : 
  'arg' should be one of “cor”, “RSS”

Hi @studentScot,

Which version of mixOmics are you using? Can you update to the latest GitHub version and re-try?

Thanks

Al

Hi Al,

I was using 6.16.2, updated to the latest GitHub version (6.17.28) and I’m still having the same issue for both errors.

Thanks,
Sam

Hi @studentScot,
In the vignette example Y is one variable and the PLS method used is PLS1. However, if Y is a matrix (PLS2) then measure has to be one of the mentioned ones. Please refer to tune.spls for more details.

Al

Hi Al,

Thank you for your help!

Using the mixOmicsTeam GitHub vignette instead of the mixOmics website vignette allowed me to plot the perf results successfully, although it is still different to the one in the vignette:

plot(perf.pls, criterion = 'Q2.total'

I’ve managed to get the tune plot working as well, but it comes with the warning:

Warning message:
The SGCCA algorithm did not converge 
 

Which I’ve read about and seems to suggest the number of components is too large (The SGCCA algorithm did not converge and length of variable selection)?

Trying to reduce the number of components seemed to have no impact, and the resulting plot is quite different to the one in the example vignette (on the website):

#This code is from the GitHub Vignette
tune.spls.cor <- tune.spls(X, Y, ncomp = 3,
                           test.keepX = list.keepX,
                           validation = "Mfold", folds = 5,
                           nrepeat = 10, progressBar = FALSE,
                           measure = 'cor')
#Which returns the error "The SGCCA algorithm did not converge"

plot(tune.spls.cor, measure = 'cor')

If I then ran the code for the optimal number of variables:

tune.spls.cor$choice.keepX

Then I get:

comp1 comp2 comp3 
    2     2     2

Compared with:

# comp1 comp2 comp3 
#    15     3    20

In the vignette, so it seems like it still isn’t quite working for me.

Thanks again for helping out.

Kind regards,
Sam