topepo / caret

caret (Classification And Regression Training) R package that contains misc functions for training and plotting classification and regression models
http://topepo.github.io/caret/index.html
1.61k stars 634 forks source link

plsda: 'length of 'dimnames' [1] not equal to array extent' #252

Closed kimberlymcm closed 8 years ago

kimberlymcm commented 9 years ago

When I try to run any data, include the example on the ?plsda R documentation, I run into an error. The plsda method runs, but when I look at summary(result), it gives me the below error. This is based on running all of the exact code from the R-documentation example, though I get this from any type of data I try to run. What does this error come from?

useSoftmax <- plsda(trainDescr, trainMDRR, ncomp = 5) summary(useSoftmax) Data: X dimension: 450 297 Y dimension: 450 2 Fit method: kernelpls Number of components considered: 5 TRAINING: % variance explained Error in dimnames(tbl) <- list(c("X", yvarnames), paste(1:object$ncomp, : length of 'dimnames' [1] not equal to array extent

FunderBolt commented 9 years ago

I get the same error! ... ? any clues?

kimberlymcm commented 9 years ago

I never figured it out :/. I just ended up using the plsda function implemented in the mixOmics R package instead. But any insights for the future would be useful!

FunderBolt commented 9 years ago

:) thanks for help! will move to mixOmics ... and if (IF) I figure something out I will let you know. c

topepo commented 9 years ago

It's not really a bug per se... the summary function calls pls:::summary.mvr which calls pls:::explvar. Because of our Y matrix being a singular matrix of binary data, it cannot compute some statistics and produces an error. Basically, it is a consequence of doing discriminant analysis.