mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
ensure that negative probabilities are always avoided
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user