refactor worst features
This commit is contained in:
parent
6a862c0e82
commit
3f3d1fd287
@ -68,22 +68,24 @@ runLineByLine ordering spec = runLineByLineGeneralized ordering spec consum
|
|||||||
formatScore = Data.Text.pack . printf "%f"
|
formatScore = Data.Text.pack . printf "%f"
|
||||||
|
|
||||||
runWorstFeatures :: ResultOrdering -> GEvalSpecification -> IO ()
|
runWorstFeatures :: ResultOrdering -> GEvalSpecification -> IO ()
|
||||||
runWorstFeatures ordering spec = runLineByLineGeneralized ordering' spec consum
|
runWorstFeatures ordering spec = runLineByLineGeneralized ordering' spec (worstFeaturesPipeline spec)
|
||||||
where consum :: ConduitT LineRecord Void (ResourceT IO) ()
|
where ordering' = forceSomeOrdering ordering
|
||||||
consum = (rank (lessByMetric $ gesMainMetric spec)
|
|
||||||
.| evalStateC 0 extractFeaturesAndPValues
|
|
||||||
.| gobbleAndDo (sortBy featureOrder)
|
worstFeaturesPipeline :: GEvalSpecification -> ConduitT LineRecord Void (ResourceT IO) ()
|
||||||
.| CL.map (encodeUtf8 . formatFeatureWithPValue)
|
worstFeaturesPipeline spec = rank (lessByMetric $ gesMainMetric spec)
|
||||||
.| CC.unlinesAscii
|
.| evalStateC 0 extractFeaturesAndPValues
|
||||||
.| CC.stdout)
|
.| gobbleAndDo (sortBy featureOrder)
|
||||||
formatOutput (LineRecord inp exp out _ score) = Data.Text.intercalate "\t" [
|
.| CL.map (encodeUtf8 . formatFeatureWithPValue)
|
||||||
|
.| CC.unlinesAscii
|
||||||
|
.| CC.stdout
|
||||||
|
where formatOutput (LineRecord inp exp out _ score) = Data.Text.intercalate "\t" [
|
||||||
formatScore score,
|
formatScore score,
|
||||||
escapeTabs inp,
|
escapeTabs inp,
|
||||||
escapeTabs exp,
|
escapeTabs exp,
|
||||||
escapeTabs out]
|
escapeTabs out]
|
||||||
formatScore :: MetricValue -> Text
|
formatScore :: MetricValue -> Text
|
||||||
formatScore = Data.Text.pack . printf "%f"
|
formatScore = Data.Text.pack . printf "%f"
|
||||||
ordering' = forceSomeOrdering ordering
|
|
||||||
featureOrder (FeatureWithPValue _ p1 _ _) (FeatureWithPValue _ p2 _ _) =
|
featureOrder (FeatureWithPValue _ p1 _ _) (FeatureWithPValue _ p2 _ _) =
|
||||||
p1 `compare` p2
|
p1 `compare` p2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user