You are using the unsplitted full data.frame to assign your y_pred and y_true.
You should assign y_pred and y_true inside the for loop using the splitted data.frame.
#Now get statistic for each Group using a for loop
res <- list()
for (n in names (spp.l)){
dat <- spp.l[[n]]
y_true = dat$Observed
y_pred = dat$Predicted
RMSLE = RMSLE(y_pred = y_pred, y_true = y_true)
res[[n]] <- data.frame(
Group=n,
RMSLE,
n.samples=nrow(dat)
)
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…