From 144f35107db72a977c37f72b14004dce6ffb60c7 Mon Sep 17 00:00:00 2001
From: Thibault Hallouin <thibault.hallouin@inrae.fr>
Date: Mon, 16 Jan 2023 13:46:25 +0100
Subject: [PATCH] fix error in ROCSS computation

---
 include/evalhyd/detail/probabilist/contingency.hpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/evalhyd/detail/probabilist/contingency.hpp b/include/evalhyd/detail/probabilist/contingency.hpp
index 13f79ab..771f768 100644
--- a/include/evalhyd/detail/probabilist/contingency.hpp
+++ b/include/evalhyd/detail/probabilist/contingency.hpp
@@ -514,7 +514,9 @@ namespace evalhyd
             {
                 // compute the area under the ROC curve
                 // xt::trapz(y, x, axis=4)
-                auto A = xt::trapz(POD, POFD, 4);
+                // (note: taking the opposite of the integration results
+                //        because POD/POFD values are in decreasing order)
+                auto A = - xt::trapz(POD, POFD, 4);
 
                 // compute the ROC skill score
                 // $SS_{ROC} = \frac{A - A_{random}}{A_{perfect} - A_{random}}$
-- 
GitLab