mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-11-04 19:25:27 -07:00
ensure that negative probabilities are always avoided
This commit is contained in:
1 parent
f4be97c152
commit
ebb61fbf1c
1 file changed
+1
-1
@@ -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