sort in --worst-features
This commit is contained in:
parent
bc1de4c3e6
commit
7503644bbe
@ -72,6 +72,7 @@ runWorstFeatures ordering spec = runLineByLineGeneralized ordering' spec consum
|
|||||||
where consum :: ConduitT LineRecord Void (ResourceT IO) ()
|
where consum :: ConduitT LineRecord Void (ResourceT IO) ()
|
||||||
consum = (rank (lessByMetric $ gesMainMetric spec)
|
consum = (rank (lessByMetric $ gesMainMetric spec)
|
||||||
.| evalStateC 0 extractFeaturesAndPValues
|
.| evalStateC 0 extractFeaturesAndPValues
|
||||||
|
.| gobbleAndDo (sortBy featureOrder)
|
||||||
.| CL.map (encodeUtf8 . formatFeatureWithPValue)
|
.| CL.map (encodeUtf8 . formatFeatureWithPValue)
|
||||||
.| CC.unlinesAscii
|
.| CC.unlinesAscii
|
||||||
.| CC.stdout)
|
.| CC.stdout)
|
||||||
@ -83,6 +84,8 @@ runWorstFeatures ordering spec = runLineByLineGeneralized ordering' spec consum
|
|||||||
formatScore :: MetricValue -> Text
|
formatScore :: MetricValue -> Text
|
||||||
formatScore = Data.Text.pack . printf "%f"
|
formatScore = Data.Text.pack . printf "%f"
|
||||||
ordering' = forceSomeOrdering ordering
|
ordering' = forceSomeOrdering ordering
|
||||||
|
featureOrder (FeatureWithPValue _ p1 _ _) (FeatureWithPValue _ p2 _ _) =
|
||||||
|
p1 `compare` p2
|
||||||
|
|
||||||
-- for commands like --worst-features we need some ordering (KeepTheOriginalOrder
|
-- for commands like --worst-features we need some ordering (KeepTheOriginalOrder
|
||||||
-- does not make sense at all)
|
-- does not make sense at all)
|
||||||
|
@ -49,7 +49,7 @@ optionsParser = GEvalOptions
|
|||||||
(flag' WorstFeatures
|
(flag' WorstFeatures
|
||||||
( long "worst-features"
|
( long "worst-features"
|
||||||
<> short 'w'
|
<> short 'w'
|
||||||
<> help "Print a ranking of worst features, i.e. features that worsen the score significantly" ))
|
<> help "Print a ranking of worst features, i.e. features that worsen the score significantly. Features are sorted using p-value for Mann-Whitney U test comparing the items with a given feature and without it. For each feature the number of occurrences, average score and p-value is given." ))
|
||||||
<|>
|
<|>
|
||||||
(Diff <$> strOption
|
(Diff <$> strOption
|
||||||
( long "diff"
|
( long "diff"
|
||||||
|
Loading…
Reference in New Issue
Block a user