From 1fdc3c344600de5932439a434abeff4b14e6591f Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Fri, 11 Jun 2021 19:02:44 +0200
Subject: [PATCH] Fix regression

---
 R/R6_AgghooCV.R    | 2 +-
 test/compareToCV.R | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/R/R6_AgghooCV.R b/R/R6_AgghooCV.R
index 9cdf19e..2734d69 100644
--- a/R/R6_AgghooCV.R
+++ b/R/R6_AgghooCV.R
@@ -98,7 +98,7 @@ AgghooCV <- R6::R6Class("AgghooCV",
         all_predictions[,v] <- private$pmodels[[v]]$model(X)
       if (private$task == "regression")
         # Easy case: just average each row
-        rowSums(all_predictions)
+        return (rowMeans(all_predictions))
       # "Hard" classification:
       apply(all_predictions, 1, function(row) {
         t <- table(row)
diff --git a/test/compareToCV.R b/test/compareToCV.R
index d3b9011..a124dd2 100644
--- a/test/compareToCV.R
+++ b/test/compareToCV.R
@@ -37,6 +37,8 @@ standardCV <- function(data, target, task = NULL, gmodel = NULL, params = NULL,
           }
         }
       }
+      else
+        mean(abs(y1 - y2))
     }
   }
 
-- 
2.44.0