Add helper function for Gonito
This commit is contained in:
parent
9198c38b1b
commit
15946b89db
@ -1,5 +1,5 @@
|
|||||||
name: geval
|
name: geval
|
||||||
version: 1.31.0.0
|
version: 1.31.1.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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
module GEval.Formatting
|
module GEval.Formatting
|
||||||
(formatTheResult, formatSimpleResult)
|
(formatTheResult, formatSimpleResult, formatTheResultWithErrorBounds)
|
||||||
where
|
where
|
||||||
|
|
||||||
import GEval.Common
|
import GEval.Common
|
||||||
@ -9,13 +9,17 @@ import Text.Printf
|
|||||||
|
|
||||||
formatTheResult :: Maybe Int -> MetricResult -> String
|
formatTheResult :: Maybe Int -> MetricResult -> String
|
||||||
formatTheResult mPrecision (SimpleRun val) = formatSimpleResult mPrecision val
|
formatTheResult mPrecision (SimpleRun val) = formatSimpleResult mPrecision val
|
||||||
formatTheResult mPrecision (BootstrapResampling vals) = (formatSimpleResult correctedPrecision pointEstimate)
|
formatTheResult mPrecision (BootstrapResampling vals) = formatTheResultWithErrorBounds mPrecision pointEstimate (Just errorBound)
|
||||||
++ "±"
|
|
||||||
++ (formatSimpleResult correctedPrecision errorBound)
|
|
||||||
where pointEstimate = (upperBound + lowerBound) / 2.0
|
where pointEstimate = (upperBound + lowerBound) / 2.0
|
||||||
errorBound = (upperBound - lowerBound) / 2.0
|
errorBound = (upperBound - lowerBound) / 2.0
|
||||||
(lowerBound, upperBound) = getConfidenceBounds defaultConfidenceLevel vals
|
(lowerBound, upperBound) = getConfidenceBounds defaultConfidenceLevel vals
|
||||||
errorBoundMagnitude = (floor (logBase 10.0 errorBound)) - 1
|
|
||||||
|
formatTheResultWithErrorBounds :: Maybe Int -> MetricValue -> Maybe MetricValue -> String
|
||||||
|
formatTheResultWithErrorBounds mPrecision pointEstimate Nothing = formatSimpleResult mPrecision pointEstimate
|
||||||
|
formatTheResultWithErrorBounds mPrecision pointEstimate (Just errorBound) = (formatSimpleResult correctedPrecision pointEstimate)
|
||||||
|
++ "±"
|
||||||
|
++ (formatSimpleResult correctedPrecision errorBound)
|
||||||
|
where errorBoundMagnitude = (floor (logBase 10.0 errorBound)) - 1
|
||||||
correctedPrecision = Just $ selectLowerPrecision (max (-errorBoundMagnitude) 0) mPrecision
|
correctedPrecision = Just $ selectLowerPrecision (max (-errorBoundMagnitude) 0) mPrecision
|
||||||
|
|
||||||
formatSimpleResult :: Maybe Int -> MetricValue -> String
|
formatSimpleResult :: Maybe Int -> MetricValue -> String
|
||||||
|
Loading…
Reference in New Issue
Block a user