1
0
forked from GitHub/gf-core

ensure that negative probabilities are always avoided

This commit is contained in:
kr.angelov
2014-03-12 13:11:23 +00:00
parent 466ef94d59
commit 3ce5339f34

View File

@@ -68,7 +68,7 @@ mkProbabilities pgf probs =
where
deflt = case length [f | (Nothing,f) <- pfs] of
0 -> 0
n -> (1 - sum [d | (Just d,f) <- pfs]) / fromIntegral n
n -> max 0 ((1 - sum [d | (Just d,f) <- pfs]) / fromIntegral n)
-- | Returns the default even distibution.
defaultProbabilities :: PGF -> Probabilities