Add auxilliary functions

This commit is contained in:
Filip Graliński 2019-02-22 11:22:12 +01:00
parent fcb16d43f1
commit 19642db43f
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,5 @@
name: geval name: geval
version: 1.16.1.0 version: 1.16.2.0
synopsis: Machine learning evaluation tools synopsis: Machine learning evaluation tools
description: Please see README.md description: Please see README.md
homepage: http://github.com/name/project homepage: http://github.com/name/project

View File

@ -14,6 +14,8 @@ module GEval.Core
Metric(..), Metric(..),
MetricOrdering(..), MetricOrdering(..),
getMetricOrdering, getMetricOrdering,
isBetter,
isBetterOrEqual,
GEvalSpecialCommand(..), GEvalSpecialCommand(..),
GEvalSpecification(..), GEvalSpecification(..),
ResultOrdering(..), ResultOrdering(..),
@ -230,6 +232,14 @@ getMetricOrdering (MultiLabelFMeasure _) = TheHigherTheBetter
getMetricOrdering MultiLabelLogLoss = TheLowerTheBetter getMetricOrdering MultiLabelLogLoss = TheLowerTheBetter
getMetricOrdering MultiLabelLikelihood = TheHigherTheBetter 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 :: Metric -> Bool
isInputNeeded CharMatch = True isInputNeeded CharMatch = True