Handle JSONl (for MultiLabel-F)
This commit is contained in:
parent
2ea53f92c7
commit
1a9fe36a9e
@ -783,14 +783,17 @@ gevalCore' TokenAccuracy _ = gevalCoreWithoutInput intoTokens
|
|||||||
| otherwise = (h, t + 1)
|
| otherwise = (h, t + 1)
|
||||||
hitsAndTotalsAgg = CC.foldl (\(h1, t1) (h2, t2) -> (h1 + h2, t1 + t2)) (0, 0)
|
hitsAndTotalsAgg = CC.foldl (\(h1, t1) (h2, t2) -> (h1 + h2, t1 + t2)) (0, 0)
|
||||||
|
|
||||||
gevalCore' (MultiLabelFMeasure beta) _ = gevalCoreWithoutInputOnItemTargets (liftOp intoWords)
|
-- only MultiLabel-F1 handled for JSONs for the time being...
|
||||||
(liftOp getWords)
|
gevalCore' (MultiLabelFMeasure beta) _ = gevalCoreWithoutInputOnItemTargets (Right . intoWords)
|
||||||
|
(Right . getWords)
|
||||||
(getCounts (==))
|
(getCounts (==))
|
||||||
countAgg
|
countAgg
|
||||||
(fMeasureOnCounts beta)
|
(fMeasureOnCounts beta)
|
||||||
where
|
where
|
||||||
getWords = Right . (Prelude.map unpack) . selectByStandardThreshold . parseIntoProbList
|
getWords (RawItemTarget t) = Prelude.map unpack $ selectByStandardThreshold $ parseIntoProbList t
|
||||||
intoWords = Right . (Prelude.map unpack) . Data.Text.words
|
getWords (PartiallyParsedItemTarget ts) = Prelude.map unpack ts
|
||||||
|
intoWords (RawItemTarget t) = Prelude.map unpack $ Data.Text.words t
|
||||||
|
intoWords (PartiallyParsedItemTarget ts) = Prelude.map unpack ts
|
||||||
|
|
||||||
gevalCore' MultiLabelLogLoss _ = gevalCoreWithoutInput intoWords
|
gevalCore' MultiLabelLogLoss _ = gevalCoreWithoutInput intoWords
|
||||||
(Right . parseIntoProbList)
|
(Right . parseIntoProbList)
|
||||||
|
@ -375,7 +375,7 @@ main = hspec $ do
|
|||||||
runGEvalTest "charmatch-complex-compressed" `shouldReturnAlmost` 0.1923076923076923
|
runGEvalTest "charmatch-complex-compressed" `shouldReturnAlmost` 0.1923076923076923
|
||||||
describe "handling jsonl format" $ do
|
describe "handling jsonl format" $ do
|
||||||
it "simple test" $
|
it "simple test" $
|
||||||
runGEvalTestExtraOptions ["-e", "expected.jsonl" ] "jsonl-simple" `shouldReturnAlmost` 0.5
|
runGEvalTestExtraOptions ["-e", "expected.jsonl" ] "jsonl-simple" `shouldReturnAlmost` 0.571428571428
|
||||||
describe "line by line mode" $ do
|
describe "line by line mode" $ do
|
||||||
let sampleChallenge =
|
let sampleChallenge =
|
||||||
GEvalSpecification
|
GEvalSpecification
|
||||||
|
Loading…
Reference in New Issue
Block a user