2 Module : Gargantext.Core.Statistics
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# LANGUAGE NoImplicitPrelude #-}
14 module Gargantext.Core.Statistics
19 import Gargantext.Prelude
20 import Numeric.Statistics.PCA (pcaReduceN)
21 import Data.Array.IArray (Array, listArray, elems)
22 import qualified Data.Vector.Storable as Vec
23 import qualified Data.List as List
24 import qualified Data.Map as Map
27 data Dimension = Dimension Int
31 -> Map t (Vec.Vector Double)
32 -> Map t (Vec.Vector Double)
33 pcaReduceTo (Dimension d) m = Map.fromList
38 m'' :: Array Int (Vec.Vector Double)
39 m'' = listArray (1, List.length m') m'
41 (txts,m') = List.unzip $ Map.toList m