Commit 2f355079 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Order 2 for small corpora

parent 63bf3a0b
...@@ -204,7 +204,8 @@ logDistributional' n m' = trace ("logDistributional'") result ...@@ -204,7 +204,8 @@ logDistributional' n m' = trace ("logDistributional'") result
-- m_{i,j} = 0 if n_{i,j} = 0 or i = j, -- m_{i,j} = 0 if n_{i,j} = 0 or i = j,
-- m_{i,j} = log(to * n_{i,j} / s_{i,j}) otherwise. -- m_{i,j} = log(to * n_{i,j} / s_{i,j}) otherwise.
mi = (.*) (matrixEye n) mi = (.*) (matrixEye n)
(map (lift1 (\x -> let x' = x * to in cond (x' < 1) 0 (log x'))) ((./) m ss)) (map (lift1 (\x -> let x' = x * to in cond (x' < 0.5) 0 (log x'))) ((./) m ss))
-- (map (lift1 (\x -> let x' = x * to in cond (x' < 1) 0 (log x'))) ((./) m ss))
-- mi_nnz :: Int -- mi_nnz :: Int
-- mi_nnz = flip indexArray Z . run $ -- mi_nnz = flip indexArray Z . run $
-- foldAll (+) 0 $ map (\a -> ifThenElse (abs a < 10^(-6 :: Exp Int)) 0 1) mi -- foldAll (+) 0 $ map (\a -> ifThenElse (abs a < 10^(-6 :: Exp Int)) 0 1) mi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment