Show results of bootstrap

This commit is contained in:
Filip Gralinski 2020-01-27 22:06:33 +01:00
parent 1cea36ac93
commit 43ff22c5dd

View File

@ -28,6 +28,8 @@ import Data.Map.Strict as M
import qualified Data.Map.Lazy as LM import qualified Data.Map.Lazy as LM
import Data.Set as S import Data.Set as S
import Data.Conduit.Bootstrap (defaultConfidenceLevel, getConfidenceBounds)
main :: IO () main :: IO ()
main = do main = do
args <- getArgs args <- getArgs
@ -114,6 +116,12 @@ formatTheMetricAndResult mPrecision (scheme, val) = (evaluationSchemeName scheme
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 mPrecision pointEstimate)
++ "±"
++ (formatSimpleResult mPrecision errorBound)
where pointEstimate = (upperBound + lowerBound) / 2.0
errorBound = (upperBound - lowerBound) / 2.0
(lowerBound, upperBound) = getConfidenceBounds defaultConfidenceLevel vals
formatSimpleResult :: Maybe Int -> MetricValue -> String formatSimpleResult :: Maybe Int -> MetricValue -> String
formatSimpleResult Nothing = show formatSimpleResult Nothing = show