mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
ensure that negative probabilities are always avoided
This commit is contained in:
@@ -68,7 +68,7 @@ mkProbabilities pgf probs =
|
|||||||
where
|
where
|
||||||
deflt = case length [f | (Nothing,f) <- pfs] of
|
deflt = case length [f | (Nothing,f) <- pfs] of
|
||||||
0 -> 0
|
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.
|
-- | Returns the default even distibution.
|
||||||
defaultProbabilities :: PGF -> Probabilities
|
defaultProbabilities :: PGF -> Probabilities
|
||||||
|
|||||||
Reference in New Issue
Block a user