Add helper function for Gonito
This commit is contained in:
parent
9198c38b1b
commit
15946b89db
@ -1,5 +1,5 @@
|
||||
name: geval
|
||||
version: 1.31.0.0
|
||||
version: 1.31.1.0
|
||||
synopsis: Machine learning evaluation tools
|
||||
description: Please see README.md
|
||||
homepage: http://github.com/name/project
|
||||
|
@ -1,5 +1,5 @@
|
||||
module GEval.Formatting
|
||||
(formatTheResult, formatSimpleResult)
|
||||
(formatTheResult, formatSimpleResult, formatTheResultWithErrorBounds)
|
||||
where
|
||||
|
||||
import GEval.Common
|
||||
@ -9,13 +9,17 @@ import Text.Printf
|
||||
|
||||
formatTheResult :: Maybe Int -> MetricResult -> String
|
||||
formatTheResult mPrecision (SimpleRun val) = formatSimpleResult mPrecision val
|
||||
formatTheResult mPrecision (BootstrapResampling vals) = (formatSimpleResult correctedPrecision pointEstimate)
|
||||
++ "±"
|
||||
++ (formatSimpleResult correctedPrecision errorBound)
|
||||
where pointEstimate = (upperBound + lowerBound) / 2.0
|
||||
errorBound = (upperBound - lowerBound) / 2.0
|
||||
(lowerBound, upperBound) = getConfidenceBounds defaultConfidenceLevel vals
|
||||
errorBoundMagnitude = (floor (logBase 10.0 errorBound)) - 1
|
||||
formatTheResult mPrecision (BootstrapResampling vals) = formatTheResultWithErrorBounds mPrecision pointEstimate (Just errorBound)
|
||||
where pointEstimate = (upperBound + lowerBound) / 2.0
|
||||
errorBound = (upperBound - lowerBound) / 2.0
|
||||
(lowerBound, upperBound) = getConfidenceBounds defaultConfidenceLevel vals
|
||||
|
||||
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
|
||||
|
||||
formatSimpleResult :: Maybe Int -> MetricValue -> String
|
||||
|
Loading…
Reference in New Issue
Block a user