showing most worsening features
This commit is contained in:
parent
3f3d1fd287
commit
c385710719
@ -213,7 +213,10 @@ getExpectedDirectory :: GEvalSpecification -> FilePath
|
|||||||
getExpectedDirectory spec = fromMaybe outDirectory $ gesExpectedDirectory spec
|
getExpectedDirectory spec = fromMaybe outDirectory $ gesExpectedDirectory spec
|
||||||
where outDirectory = gesOutDirectory spec
|
where outDirectory = gesOutDirectory spec
|
||||||
|
|
||||||
data GEvalSpecialCommand = Init | LineByLine | WorstFeatures | Diff FilePath | PrintVersion
|
data GEvalSpecialCommand = Init
|
||||||
|
| LineByLine | WorstFeatures
|
||||||
|
| Diff FilePath | MostWorseningFeatures FilePath
|
||||||
|
| PrintVersion
|
||||||
|
|
||||||
data ResultOrdering = KeepTheOriginalOrder | FirstTheWorst | FirstTheBest
|
data ResultOrdering = KeepTheOriginalOrder | FirstTheWorst | FirstTheBest
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ module GEval.LineByLine
|
|||||||
runWorstFeatures,
|
runWorstFeatures,
|
||||||
runLineByLineGeneralized,
|
runLineByLineGeneralized,
|
||||||
runDiff,
|
runDiff,
|
||||||
|
runMostWorseningFeatures,
|
||||||
runDiffGeneralized,
|
runDiffGeneralized,
|
||||||
LineRecord(..),
|
LineRecord(..),
|
||||||
ResultOrdering(..)
|
ResultOrdering(..)
|
||||||
@ -212,6 +213,17 @@ runDiff ordering otherOut spec = runDiffGeneralized ordering otherOut spec consu
|
|||||||
formatScoreDiff :: Double -> Text
|
formatScoreDiff :: Double -> Text
|
||||||
formatScoreDiff = Data.Text.pack . printf "%f"
|
formatScoreDiff = Data.Text.pack . printf "%f"
|
||||||
|
|
||||||
|
runMostWorseningFeatures :: ResultOrdering -> FilePath -> GEvalSpecification -> IO ()
|
||||||
|
runMostWorseningFeatures ordering otherOut spec = runDiffGeneralized ordering' otherOut spec consum
|
||||||
|
where ordering' = forceSomeOrdering ordering
|
||||||
|
consum :: ConduitT (LineRecord, LineRecord) Void (ResourceT IO) ()
|
||||||
|
consum = CC.map prepareFakeLineRecord
|
||||||
|
.| (worstFeaturesPipeline spec)
|
||||||
|
prepareFakeLineRecord :: (LineRecord, LineRecord) -> LineRecord
|
||||||
|
prepareFakeLineRecord (LineRecord _ _ _ _ scorePrev, LineRecord inp exp out c score) =
|
||||||
|
LineRecord inp exp out c (score - scorePrev)
|
||||||
|
|
||||||
|
|
||||||
runDiffGeneralized :: ResultOrdering -> FilePath -> GEvalSpecification -> ConduitT (LineRecord, LineRecord) Void (ResourceT IO) a -> IO a
|
runDiffGeneralized :: ResultOrdering -> FilePath -> GEvalSpecification -> ConduitT (LineRecord, LineRecord) Void (ResourceT IO) a -> IO a
|
||||||
runDiffGeneralized ordering otherOut spec consum = do
|
runDiffGeneralized ordering otherOut spec consum = do
|
||||||
(inputSource, expectedSource, outSource) <- checkAndGetFilesSingleOut True spec
|
(inputSource, expectedSource, outSource) <- checkAndGetFilesSingleOut True spec
|
||||||
|
@ -55,7 +55,13 @@ optionsParser = GEvalOptions
|
|||||||
( long "diff"
|
( long "diff"
|
||||||
<> short 'd'
|
<> short 'd'
|
||||||
<> metavar "OTHER-OUT"
|
<> metavar "OTHER-OUT"
|
||||||
<> help "compare results")))
|
<> help "compare results"))
|
||||||
|
<|>
|
||||||
|
(MostWorseningFeatures <$> strOption
|
||||||
|
( long "most-worsening-features"
|
||||||
|
<> short 'm'
|
||||||
|
<> help "Print a ranking of the \"most worsening\" features, i.e. features that worsen the score the most when comparing outputs from two systems.")))
|
||||||
|
|
||||||
<*> ((flag' FirstTheWorst
|
<*> ((flag' FirstTheWorst
|
||||||
(long "sort"
|
(long "sort"
|
||||||
<> short 's'
|
<> short 's'
|
||||||
@ -205,6 +211,9 @@ runGEval''' (Just WorstFeatures) ordering spec = do
|
|||||||
runGEval''' (Just (Diff otherOut)) ordering spec = do
|
runGEval''' (Just (Diff otherOut)) ordering spec = do
|
||||||
runDiff ordering otherOut spec
|
runDiff ordering otherOut spec
|
||||||
return Nothing
|
return Nothing
|
||||||
|
runGEval''' (Just (MostWorseningFeatures otherOut)) ordering spec = do
|
||||||
|
runMostWorseningFeatures ordering otherOut spec
|
||||||
|
return Nothing
|
||||||
|
|
||||||
initChallenge :: GEvalSpecification -> IO ()
|
initChallenge :: GEvalSpecification -> IO ()
|
||||||
initChallenge spec = case gesExpectedDirectory spec of
|
initChallenge spec = case gesExpectedDirectory spec of
|
||||||
|
Loading…
Reference in New Issue
Block a user