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

View File

@ -16,6 +16,7 @@ import qualified Data.Text as T
import qualified Data.Map.Strict as M
import GEval.Core
import GEval.Common
import GEval.EvaluationScheme
import GEval.OptionsParser
import GEval.ParseParams (parseParamsFromFilePath, OutputFileParsed(..))
@ -224,7 +225,10 @@ checkOrInsertEvaluation repoDir chan version out = do
Right (Left _) -> do
err chan "Cannot parse options, check the challenge repo"
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
_ <- runDB $ insert $ let (pointResult, errorBound) = extractResult result
in Evaluation {

View File

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

View File

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

View File

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