diff --git a/geval.cabal b/geval.cabal index 4493d8b..256f1a1 100644 --- a/geval.cabal +++ b/geval.cabal @@ -1,5 +1,5 @@ name: geval -version: 1.16.1.0 +version: 1.16.2.0 synopsis: Machine learning evaluation tools description: Please see README.md homepage: http://github.com/name/project diff --git a/src/GEval/Core.hs b/src/GEval/Core.hs index eefd23b..33deecd 100644 --- a/src/GEval/Core.hs +++ b/src/GEval/Core.hs @@ -14,6 +14,8 @@ module GEval.Core Metric(..), MetricOrdering(..), getMetricOrdering, + isBetter, + isBetterOrEqual, GEvalSpecialCommand(..), GEvalSpecification(..), ResultOrdering(..), @@ -230,6 +232,14 @@ getMetricOrdering (MultiLabelFMeasure _) = TheHigherTheBetter getMetricOrdering MultiLabelLogLoss = TheLowerTheBetter getMetricOrdering MultiLabelLikelihood = TheHigherTheBetter +isBetterOrEqual :: Metric -> MetricValue -> MetricValue -> Bool +isBetterOrEqual metric valA valB = not (isBetter metric valB valA) + +isBetter :: Metric -> MetricValue -> MetricValue -> Bool +isBetter metric valA valB = isBetter' metricOrdering valA valB + where isBetter' TheHigherTheBetter valA valB = valA > valB + isBetter' TheLowerTheBetter valA valB = valA < valB + metricOrdering = getMetricOrdering metric isInputNeeded :: Metric -> Bool isInputNeeded CharMatch = True