Update to the newest GEval

This commit is contained in:
Filip Gralinski 2020-08-08 21:52:44 +02:00
parent b42549cede
commit 55d06e3347
5 changed files with 23 additions and 8 deletions

View File

@ -12,6 +12,7 @@ import GEval.Core
import GEval.OptionsParser import GEval.OptionsParser
import GEval.EvaluationScheme import GEval.EvaluationScheme
import GEval.Validation import GEval.Validation
import GEval.Common (FormattingOptions(..))
import Gonito.ExtractMetadata (getLastCommitMessage) import Gonito.ExtractMetadata (getLastCommitMessage)
@ -392,7 +393,7 @@ insertOrUpdateTest testDir challengeId checksum commit opts (priority, metric) =
mAlreadyExistingTest <- getBy $ UniqueChallengeNameMetricChecksum challengeId name metric checksum mAlreadyExistingTest <- getBy $ UniqueChallengeNameMetricChecksum challengeId name metric checksum
case mAlreadyExistingTest of case mAlreadyExistingTest of
Just (Entity testId _) -> update testId [TestCommit=.commit, Just (Entity testId _) -> update testId [TestCommit=.commit,
TestPrecision=.(gesPrecision $ geoSpec opts), TestPrecision=. (decimalPlaces $ gesFormatting $ geoSpec opts),
TestPriority=.Just priority] TestPriority=.Just priority]
Nothing -> do Nothing -> do
_ <- insert $ Test { _ <- insert $ Test {
@ -402,7 +403,7 @@ insertOrUpdateTest testDir challengeId checksum commit opts (priority, metric) =
testChecksum=checksum, testChecksum=checksum,
testCommit=commit, testCommit=commit,
testActive=True, testActive=True,
testPrecision=gesPrecision $ geoSpec opts, testPrecision=decimalPlaces $ gesFormatting $ geoSpec opts,
testPriority=Just priority} testPriority=Just priority}
return () return ()

View File

@ -16,6 +16,7 @@ import qualified Data.Text as T
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import GEval.Core import GEval.Core
import GEval.Common
import GEval.EvaluationScheme import GEval.EvaluationScheme
import GEval.OptionsParser import GEval.OptionsParser
import GEval.ParseParams (parseParamsFromFilePath, OutputFileParsed(..)) import GEval.ParseParams (parseParamsFromFilePath, OutputFileParsed(..))
@ -224,7 +225,10 @@ checkOrInsertEvaluation repoDir chan version out = do
Right (Left _) -> do Right (Left _) -> do
err chan "Cannot parse options, check the challenge repo" err chan "Cannot parse options, check the challenge repo"
Right (Right (_, Just [(_, [result])])) -> do Right (Right (_, Just [(_, [result])])) -> do
msg chan $ concat [ "Evaluated! Score ", (T.pack $ formatTheResult Nothing result) ] let defaultFormattingOpts = FormattingOptions {
decimalPlaces = Nothing,
asPercentage = False }
msg chan $ concat [ "Evaluated! Score ", (T.pack $ formatTheResult defaultFormattingOpts result) ]
time <- liftIO getCurrentTime time <- liftIO getCurrentTime
_ <- runDB $ insert $ let (pointResult, errorBound) = extractResult result _ <- runDB $ insert $ let (pointResult, errorBound) = extractResult result
in Evaluation { in Evaluation {

View File

@ -27,6 +27,7 @@ import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3)
import Data.Conduit.SmartSource (lookForCompressedFiles) import Data.Conduit.SmartSource (lookForCompressedFiles)
import GEval.Core (GEvalSpecification(..), ResultOrdering(..)) import GEval.Core (GEvalSpecification(..), ResultOrdering(..))
import GEval.LineByLine (runLineByLineGeneralized, LineRecord(..)) import GEval.LineByLine (runLineByLineGeneralized, LineRecord(..))
import GEval.Common (FormattingOptions(..))
import qualified Data.Conduit.List as CL import qualified Data.Conduit.List as CL
import System.FilePath (takeFileName) import System.FilePath (takeFileName)
@ -279,7 +280,9 @@ viewOutput entry tests (outputHash, testSet) = do
gesExpectedFile = "expected.tsv", gesExpectedFile = "expected.tsv",
gesInputFile = "in.tsv", gesInputFile = "in.tsv",
gesMetrics = [mainMetric], gesMetrics = [mainMetric],
gesPrecision = Nothing, gesFormatting = FormattingOptions {
decimalPlaces = Nothing,
asPercentage = False },
gesTokenizer = Nothing, gesTokenizer = Nothing,
gesGonitoHost = Nothing, gesGonitoHost = Nothing,
gesToken = Nothing, gesToken = Nothing,
@ -287,7 +290,8 @@ viewOutput entry tests (outputHash, testSet) = do
gesReferences = Nothing, gesReferences = Nothing,
gesBootstrapResampling = Nothing, gesBootstrapResampling = Nothing,
gesInHeader = Nothing, gesInHeader = Nothing,
gesOutHeader = Nothing } gesOutHeader = Nothing,
gesShowPreprocessed = True }
result <- liftIO $ runLineByLineGeneralized FirstTheWorst spec (\_ -> CL.take 20) result <- liftIO $ runLineByLineGeneralized FirstTheWorst spec (\_ -> CL.take 20)

View File

@ -40,6 +40,7 @@ import System.IO.Unsafe (unsafePerformIO)
import Text.Regex.TDFA import Text.Regex.TDFA
import GEval.Core import GEval.Core
import GEval.Common
import GEval.EvaluationScheme import GEval.EvaluationScheme
import GEval.Formatting (formatTheResultWithErrorBounds) import GEval.Formatting (formatTheResultWithErrorBounds)
@ -450,8 +451,13 @@ formatTruncatedScore :: Maybe Int -> Maybe Evaluation -> Text
formatTruncatedScore Nothing e = formatFullScore e formatTruncatedScore Nothing e = formatFullScore e
formatTruncatedScore _ Nothing = formatFullScore Nothing formatTruncatedScore _ Nothing = formatFullScore Nothing
formatTruncatedScore (Just precision) (Just evaluation) = case evaluationScore evaluation of formatTruncatedScore (Just precision) (Just evaluation) = case evaluationScore evaluation of
Just score -> T.pack $ formatTheResultWithErrorBounds (Just precision) score (evaluationErrorBound evaluation) Just score -> T.pack $ formatTheResultWithErrorBounds formattingOpts score (evaluationErrorBound evaluation)
Nothing -> formatFullScore Nothing Nothing -> formatFullScore Nothing
where formattingOpts = FormattingOptions {
decimalPlaces = Just precision,
asPercentage = False
}
formatScore :: Maybe Int -> Double -> Text formatScore :: Maybe Int -> Double -> Text
formatScore Nothing = T.pack . show formatScore Nothing = T.pack . show

View File

@ -1,5 +1,5 @@
name: gonito name: gonito
version: 0.1.0 version: 0.1.1
cabal-version: >= 1.8 cabal-version: >= 1.8
build-type: Simple build-type: Simple
homepage: http://gonito.net homepage: http://gonito.net
@ -129,7 +129,7 @@ library
, filemanip , filemanip
, cryptohash , cryptohash
, markdown , markdown
, geval >= 1.32 && < 1.37 , geval >= 1.37 && < 1.38
, filepath , filepath
, yesod-table , yesod-table
, regex-tdfa , regex-tdfa