Fix corner cases in calibration
This commit is contained in:
parent
feacd5844c
commit
de40851b5a
@ -35,8 +35,9 @@ softCalibration _ [] = error "too few probabilities in calibration"
|
|||||||
softCalibration results probs
|
softCalibration results probs
|
||||||
| band probs < minBand = handleNarrowBand results probs
|
| band probs < minBand = handleNarrowBand results probs
|
||||||
| otherwise = 1.0 - (min 1.0 (2.0 * (integrate (lowest, highest) (\x -> abs ((loess (DVU.fromList probs) (DVU.fromList results) x) - x))) / (highest - lowest)))
|
| otherwise = 1.0 - (min 1.0 (2.0 * (integrate (lowest, highest) (\x -> abs ((loess (DVU.fromList probs) (DVU.fromList results) x) - x))) / (highest - lowest)))
|
||||||
where lowest = minimum probs
|
where lowest = (minimum probs) + epsilon -- integrating loess gets crazy at edges
|
||||||
highest = maximum probs
|
highest = (maximum probs) - epsilon
|
||||||
|
epsilon = 0.0001
|
||||||
|
|
||||||
handleNarrowBand :: [Double] -> [Double] -> Double
|
handleNarrowBand :: [Double] -> [Double] -> Double
|
||||||
handleNarrowBand results probs = 1.0 - deviation
|
handleNarrowBand results probs = 1.0 - deviation
|
||||||
|
@ -755,7 +755,7 @@ gevalCore' (ProbabilisticSoftFMeasure beta) _ = gevalCoreWithoutInput parseAnnot
|
|||||||
probabilisticSoftAgg = CC.foldl probabilisticSoftFolder ([], [], fromInteger 0, 0)
|
probabilisticSoftAgg = CC.foldl probabilisticSoftFolder ([], [], fromInteger 0, 0)
|
||||||
probabilisticSoftFolder (r1, p1, g1, e1) (r2, p2, g2, e2) = (r1 ++ r2, p1 ++ p2, g1 + g2, e1 + e2)
|
probabilisticSoftFolder (r1, p1, g1, e1) (r2, p2, g2, e2) = (r1 ++ r2, p1 ++ p2, g1 + g2, e1 + e2)
|
||||||
loessGraph :: ([Double], [Double], Double, Int) -> Maybe GraphSeries
|
loessGraph :: ([Double], [Double], Double, Int) -> Maybe GraphSeries
|
||||||
loessGraph (results, probs, _, _) = Just $ GraphSeries $ Prelude.map (\x -> (x, loess probs' results' x)) $ Prelude.filter (\p -> p >= lowest && p <= highest) $ Prelude.map (\d -> 0.01 * (fromIntegral d)) [1..99]
|
loessGraph (results, probs, _, _) = Just $ GraphSeries $ Prelude.map (\x -> (x, loess probs' results' x)) $ Prelude.filter (\p -> p > lowest && p < highest) $ Prelude.map (\d -> 0.01 * (fromIntegral d)) [1..99]
|
||||||
where results' = DVU.fromList results
|
where results' = DVU.fromList results
|
||||||
probs' = DVU.fromList probs
|
probs' = DVU.fromList probs
|
||||||
lowest = Data.List.minimum probs
|
lowest = Data.List.minimum probs
|
||||||
|
Loading…
Reference in New Issue
Block a user