Commit b85cbefa authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Graph of Order 2 A or 2 B ? Here is the fix of the Order 2B to replace

the 2A, which is my recommendation.

For some reasons that should be better analyzed, during the computation
of the Distributional similarity using Accelerate some parts of the
matrix are are below 1 (see the line modified by this commit). As a
consequence the log of such value below 1 gives a negative value that is
breaking the whole similarity computation: the matrix has negative and
non negative values and is becoming inconsistent.

The main fix consists in managing the values below 1 in order to get a
non negative matrix.

The Order 2A fixes the issue by adding 1 on each cell of the matrix.
The Order 2B fixes the issue by removing values below 1 only.

According to the qualitative tests I made the Graph results of order 2B
is better than the results of order 2A. Filtering seems better than
forcing using all data where some seems to be not "representative" enough.
parent ad928574
......@@ -203,8 +203,8 @@ logDistributional' o n m' = trace ("logDistributional'") result
-- Matrix nxn. mi = [m_{i,j}]_{i,j} where
-- m_{i,j} = 0 if n_{i,j} = 0 or i = j,
-- m_{i,j} = log(to * n_{i,j} / s_{i,j}) otherwise.
mi = (.*) (matrixEye n)
(map (lift1 (\x -> cond (x == 0) 0 (log (o + x * to)))) ((./) m ss))
mi = map (\x -> cond (x < 1) 0 (log x)) $ (.*) (matrixEye n)
(map (lift1 (\x -> cond (x == 0) 0 (o + x * to))) ((./) m ss))
-- mi_nnz :: Int
-- mi_nnz = flip indexArray Z . run $
-- 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