Commit 22b6aa97 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] clustering, order 2 similarity, ok

parent badfdf60
...@@ -9,6 +9,8 @@ Portability : POSIX ...@@ -9,6 +9,8 @@ Portability : POSIX
-} -}
{-# LANGUAGE ScopedTypeVariables #-}
module Gargantext.Core.Viz.Graph.Tools module Gargantext.Core.Viz.Graph.Tools
where where
...@@ -78,7 +80,8 @@ cooc2graphWith' :: ToComId a ...@@ -78,7 +80,8 @@ cooc2graphWith' :: ToComId a
cooc2graphWith' doPartitions distance threshold myCooc = do cooc2graphWith' doPartitions distance threshold myCooc = do
let let
-- TODO remove below -- TODO remove below
theMatrix = Map.fromList $ HashMap.toList myCooc theMatrix = Map.fromList
$ HashMap.toList myCooc
(ti, _) = createIndices theMatrix (ti, _) = createIndices theMatrix
myCooc' = toIndex ti theMatrix myCooc' = toIndex ti theMatrix
...@@ -99,7 +102,13 @@ cooc2graphWith' doPartitions distance threshold myCooc = do ...@@ -99,7 +102,13 @@ cooc2graphWith' doPartitions distance threshold myCooc = do
printDebug "Similarities" similarities printDebug "Similarities" similarities
let let
distanceMap = case distance of links = round (let n :: Double = fromIntegral (Map.size ti) in n * log n)
distanceMap = Map.fromList
$ List.take links
$ List.sortOn snd
$ Map.toList
$ case distance of
Conditional -> Map.filter (> threshold) Conditional -> Map.filter (> threshold)
Distributional -> Map.filter (> 0) Distributional -> Map.filter (> 0)
$ mat2map similarities $ mat2map similarities
......
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