Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344555 )

Change subject: Stats: Invert "false" thresholds so they're correct
......................................................................

Stats: Invert "false" thresholds so they're correct

Bug: T161250
Change-Id: I4efbdfaec44d24caf20e2548d05bb3d7c2490a1e
(cherry picked from commit d80c88169de927dd37c0c34e10c2e3b698fbc010)
---
M includes/Stats.php
M tests/phpunit/includes/StatsTest.php
2 files changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES 
refs/changes/55/344555/1

diff --git a/includes/Stats.php b/includes/Stats.php
index 1c08a92..8dc2774 100644
--- a/includes/Stats.php
+++ b/includes/Stats.php
@@ -162,7 +162,10 @@
                $stat = $config[ 'stat' ];
                $outcome = $config[ 'outcome' ];
                if ( isset( $statsData[ $stat ][ $outcome ][ 'threshold' ] ) ) {
-                       return $statsData[ $stat ][ $outcome ][ 'threshold' ];
+                       $threshold = $statsData[ $stat ][ $outcome ][ 
'threshold' ];
+                       // Thresholds reported for "false" outcomes apply to 
"false" scores, but we always
+                       // apply thresholds against "true" scores, so we need 
to invert "false" thresholds here.
+                       return $outcome === 'false' ? 1 - $threshold : 
$threshold;
                }
 
                $this->logger->warning(
diff --git a/tests/phpunit/includes/StatsTest.php 
b/tests/phpunit/includes/StatsTest.php
index cb1a9fe..4dafebf 100644
--- a/tests/phpunit/includes/StatsTest.php
+++ b/tests/phpunit/includes/StatsTest.php
@@ -63,7 +63,7 @@
                        [
                                'likelygood' => [
                                        'min' => 0,
-                                       'max' => 0.259,
+                                       'max' => 0.741, // 1-0.259
                                ],
                                'maybebad' => [
                                        'min' => 0.281,
@@ -116,11 +116,11 @@
                                ],
                                'maybebad' => [
                                        'min' => 0,
-                                       'max' => 0.322,
+                                       'max' => 0.678, // 1-0.322
                                ],
                                'bad' => [
                                        'min' => 0,
-                                       'max' => 0.808,
+                                       'max' => 0.192, // 1-0.808
                                ]
                        ]
                );

-- 
To view, visit https://gerrit.wikimedia.org/r/344555
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4efbdfaec44d24caf20e2548d05bb3d7c2490a1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: wmf/1.29.0-wmf.17
Gerrit-Owner: Catrope <r...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to