Commit e12b5d7c authored by DURIF Ghislain's avatar DURIF Ghislain

fix a bug on the computation of the error in spls.cv

parent 17f84dea
......@@ -7,9 +7,9 @@ source("env.R")
# sample
n = 100
p = 1000
kstar = 500
lstar = 250
p = 100
kstar = 50
lstar = 10
beta.min = 0.5
beta.max = 1
mean.H=0
......
......@@ -443,7 +443,8 @@ spls.cv <- function(X, Y, lambda.l1.range, ncomp.range, weight.mat=NULL,
res = numeric(6)
if(!is.null(model)) {
res = c(k, run, paramGrid$lambdaL1[gridRow], paramGrid$ncomp[gridRow], model$lenA, sum((model$hatYtest - sYtest)^2) / ntest)
res = c(k, run, paramGrid$lambdaL1[gridRow], paramGrid$ncomp[gridRow],
model$lenA, sum((model$hatYtest - get(paste0("sYtest_", k, "_", run)))^2) / ntest)
} else {
res = c(k, run, paramGrid$lambdaL1[gridRow], paramGrid$ncomp[gridRow], 0, NA)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment