Model 1 Trained in Start with RAW data
n <- 145 ; p <- 8
X=as.matrix(Start)
Y=as.matrix(ClassRoses)
dim(X)
dim(Y)
Xcal <- X[1:100, ] ; ycal <- Y[1:100]
Xval <- X[101:145, ] ; yval <- Y[101:145]
m <- 50 ; p <- 8
nlv <- 20
segm<-segmkf(45, y = NULL, K = 5, type = c("random"), nrep = 1)
pars <- mpars(nlv = 1:nlv)
res <- gridscorelv(Xcal, ycal, Xval, yval, score = err,fun = plsrda, nlv = 1:nlv, verb = TRUE)
Xtrain <- rbind(Xcal, Xval)
ytrain <- c(ycal, yval)
dim(Xtrain)
dim(ytrain)
#res = gridcv(Xcal, ycal, segm, score = rmsep , fun = plsrda, pars, verb = TRUE)
plotscore(res$nlv, res$y1, main = "ERR", xlab = "Nb. LVs", ylab = "Value")
u <- res[res$y1 == min(res$y1), ][1, , drop = FALSE]
# Final model on Xtrain = Xcal+Xval
fm <- plsrda(Xtrain, ytrain, nlv = u$nlv)
Prediction in Day 1
Xtest <- Day1mx
ytest <- as.matrix(ClassRoses)
pred1 <- predict(fm, Xtest)$pred
err(ytest, pred1)
My questions are:
-
I have this output when I use GRIDSCORELV function for Cross validation:
Nb combinations = 0
End.
How can I solve this problem and add some combinations to the analysis? -
I would like to do Stratified sampling (I am doing a classification PLSDA analysis in order to classify inoculated from non inoculated petals).
Thank you for your help!
Regards,
Mercedes