Commit 4b742e1f authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Revert "wip - disable debug logs for Phylo code"

This reverts commit a60a1be7.
parent a60a1be7
...@@ -49,7 +49,7 @@ main = do ...@@ -49,7 +49,7 @@ main = do
whnfIO (toUserHash $ NewUser "alfredo" "alfredo@well-typed.com" (GargPassword "rabbit")) whnfIO (toUserHash $ NewUser "alfredo" "alfredo@well-typed.com" (GargPassword "rabbit"))
] ]
, bgroup "Phylo" [ , bgroup "Phylo" [
bench "toPhylo (small)" $ nf (toPhyloWithOptions (ToPhyloOptions False) issue290PhyloSmall bench "toPhylo (small)" $ nf toPhylo issue290PhyloSmall
] ]
] ]
] ]
...@@ -41,22 +41,19 @@ phyloExport = dotToFile "/home/qlobbe/data/phylo/output/cesar_cleopatre_V2.dot" ...@@ -41,22 +41,19 @@ phyloExport = dotToFile "/home/qlobbe/data/phylo/output/cesar_cleopatre_V2.dot"
phyloDot :: DotGraph DotId phyloDot :: DotGraph DotId
phyloDot = toPhyloExport phyloCleopatre phyloDot = toPhyloExport phyloCleopatre
phyloOpts :: ToPhyloOptions
phyloOpts = ToPhyloOptions True -- enable debug logs
-------------------------------------------------- --------------------------------------------------
-- | STEP 4 | -- Process the synchronic clustering -- | STEP 4 | -- Process the synchronic clustering
-------------------------------------------------- --------------------------------------------------
phyloCleopatre :: Phylo phyloCleopatre :: Phylo
phyloCleopatre = synchronicClustering phyloOpts $ toHorizon flatPhylo phyloCleopatre = synchronicClustering $ toHorizon flatPhylo
----------------------------------------------- -----------------------------------------------
-- | STEP 3 | -- Build the Level 1 of the Phylo -- | STEP 3 | -- Build the Level 1 of the Phylo
----------------------------------------------- -----------------------------------------------
flatPhylo :: Phylo flatPhylo :: Phylo
flatPhylo = temporalMatching phyloOpts (getLadder emptyPhylo') emptyPhylo' flatPhylo = temporalMatching (getLadder emptyPhylo') emptyPhylo'
emptyPhylo' :: Phylo emptyPhylo' :: Phylo
emptyPhylo' = joinRoots emptyPhylo' = joinRoots
......
...@@ -11,21 +11,7 @@ Portability : POSIX ...@@ -11,21 +11,7 @@ Portability : POSIX
{-# OPTIONS_GHC -fno-warn-deprecations #-} {-# OPTIONS_GHC -fno-warn-deprecations #-}
module Gargantext.Core.Viz.Phylo.PhyloMaker ( module Gargantext.Core.Viz.Phylo.PhyloMaker where
toPhylo
, toPhyloWithOptions
, toPhyloWithoutLink
, appendGroups
, clusterToGroup
, docsToTimeScaleCooc
, docsToTimeScaleNb
, findSeaLadder
, groupDocsByPeriod
, initPhylo
, joinRoots
, toSeriesOfClustering
) where
import Control.Lens hiding (Level) import Control.Lens hiding (Level)
...@@ -57,23 +43,17 @@ data Phylo' = PhyloBase { _phylo'_phyloBase :: Phylo} ...@@ -57,23 +43,17 @@ data Phylo' = PhyloBase { _phylo'_phyloBase :: Phylo}
| PhyloN { _phylo'_flatPhylo :: Phylo} | PhyloN { _phylo'_flatPhylo :: Phylo}
toPhylo' :: Phylo' -> [Document] -> TermList -> PhyloConfig -> Phylo toPhylo' :: Phylo' -> [Document] -> TermList -> PhyloConfig -> Phylo
toPhylo' (PhyloN phylo) = toPhylo' toPhylo' (PhyloN phylo) = toPhylo'
toPhylo' (PhyloBase phylo) = toPhylo toPhylo' (PhyloBase phylo) = toPhylo
-} -}
toPhylo :: Phylo -> Phylo
toPhylo = toPhyloWithOptions (ToPhyloOptions True)
-- TODO an adaptative synchronic clustering with a slider -- TODO an adaptative synchronic clustering with a slider
-- FIXME(adn) Currently we emit traces from pure code(!!). This is obviously not very nice
-- and it breaks referencial transparency; we ought to fix it, but in order to smooth out toPhylo :: Phylo -> Phylo
-- the compatibility story, for now we keep the status quo. toPhylo phylowithoutLink = traceToPhylo (phyloScale $ getConfig phylowithoutLink) $
toPhyloWithOptions :: ToPhyloOptions -> Phylo -> Phylo
toPhyloWithOptions phyloOpts phylowithoutLink = traceToPhylo phyloOpts (phyloScale $ getConfig phylowithoutLink) $
if (phyloScale $ getConfig phylowithoutLink) > 1 if (phyloScale $ getConfig phylowithoutLink) > 1
then foldl' (\phylo' _ -> synchronicClustering phyloOpts phylo') phyloAncestors [2..(phyloScale $ getConfig phylowithoutLink)] then foldl' (\phylo' _ -> synchronicClustering phylo') phyloAncestors [2..(phyloScale $ getConfig phylowithoutLink)]
else phyloAncestors else phyloAncestors
where where
-------------------------------------- --------------------------------------
...@@ -84,7 +64,7 @@ toPhyloWithOptions phyloOpts phylowithoutLink = traceToPhylo phyloOpts (phyloSca ...@@ -84,7 +64,7 @@ toPhyloWithOptions phyloOpts phylowithoutLink = traceToPhylo phyloOpts (phyloSca
else phyloWithLinks else phyloWithLinks
-------------------------------------- --------------------------------------
phyloWithLinks :: Phylo phyloWithLinks :: Phylo
phyloWithLinks = temporalMatching phyloOpts (getLadder phylowithoutLink) phylowithoutLink phyloWithLinks = temporalMatching (getLadder phylowithoutLink) phylowithoutLink
-------------------------------------- --------------------------------------
......
This diff is collapsed.
...@@ -72,8 +72,8 @@ addPhyloScale lvl phylo = ...@@ -72,8 +72,8 @@ addPhyloScale lvl phylo =
(PhyloScale (phyloPrd ^. phylo_periodPeriod) (phyloPrd ^. phylo_periodPeriodStr) lvl empty))) phylo (PhyloScale (phyloPrd ^. phylo_periodPeriod) (phyloPrd ^. phylo_periodPeriodStr) lvl empty))) phylo
toNextScale :: ToPhyloOptions -> Phylo -> [PhyloGroup] -> Phylo toNextScale :: Phylo -> [PhyloGroup] -> Phylo
toNextScale opts phylo groups = toNextScale phylo groups =
let curLvl = getLastLevel phylo let curLvl = getLastLevel phylo
oldGroups = fromList $ map (\g -> (getGroupId g, getLevelParentId g)) groups oldGroups = fromList $ map (\g -> (getGroupId g, getLevelParentId g)) groups
newGroups = concat $ groupsToBranches' newGroups = concat $ groupsToBranches'
...@@ -86,7 +86,7 @@ toNextScale opts phylo groups = ...@@ -86,7 +86,7 @@ toNextScale opts phylo groups =
$ fromListWith (++) $ map (\g -> (getLevelParentId g, [g])) groups $ fromListWith (++) $ map (\g -> (getLevelParentId g, [g])) groups
newPeriods = fromListWith (++) $ map (\g -> (g ^. phylo_groupPeriod, [g])) newGroups newPeriods = fromListWith (++) $ map (\g -> (g ^. phylo_groupPeriod, [g])) newGroups
in traceSynchronyEnd opts in traceSynchronyEnd
$ over ( phylo_periods . traverse . phylo_periodScales . traverse $ over ( phylo_periods . traverse . phylo_periodScales . traverse
-- 6) update each period at curLvl + 1 -- 6) update each period at curLvl + 1
. filtered (\phyloLvl -> phyloLvl ^. phylo_scaleScale == (curLvl + 1))) . filtered (\phyloLvl -> phyloLvl ^. phylo_scaleScale == (curLvl + 1)))
...@@ -205,8 +205,8 @@ levelUpAncestors groups = ...@@ -205,8 +205,8 @@ levelUpAncestors groups =
in g & phylo_groupAncestors .~ ancestors' in g & phylo_groupAncestors .~ ancestors'
) groups ) groups
synchronicClustering :: ToPhyloOptions -> Phylo -> Phylo synchronicClustering :: Phylo -> Phylo
synchronicClustering opts phylo = synchronicClustering phylo =
let prox = similarity $ getConfig phylo let prox = similarity $ getConfig phylo
sync = phyloSynchrony $ getConfig phylo sync = phyloSynchrony $ getConfig phylo
docs = getDocsByDate phylo docs = getDocsByDate phylo
...@@ -215,9 +215,9 @@ synchronicClustering opts phylo = ...@@ -215,9 +215,9 @@ synchronicClustering opts phylo =
$ map processDynamics $ map processDynamics
$ chooseClusteringStrategy sync $ chooseClusteringStrategy sync
$ phyloLastScale $ phyloLastScale
$ traceSynchronyStart opts phylo $ traceSynchronyStart phylo
newBranches' = newBranches `using` parList rdeepseq newBranches' = newBranches `using` parList rdeepseq
in toNextScale opts phylo $ levelUpAncestors $ concat newBranches' in toNextScale phylo $ levelUpAncestors $ concat newBranches'
-- synchronicDistance :: Phylo -> Level -> String -- synchronicDistance :: Phylo -> Level -> String
......
...@@ -679,9 +679,9 @@ seaLevelRise fdt similarity lambda minBranch frequency ladder rise frame periods ...@@ -679,9 +679,9 @@ seaLevelRise fdt similarity lambda minBranch frequency ladder rise frame periods
{- {-
-- start the temporal matching process up, recover the resulting branches and update the groups (at scale 1) consequently -- start the temporal matching process up, recover the resulting branches and update the groups (at scale 1) consequently
-} -}
temporalMatching :: ToPhyloOptions -> [Double] -> Phylo -> Phylo temporalMatching :: [Double] -> Phylo -> Phylo
temporalMatching opts ladder phylo = updatePhyloGroups 1 temporalMatching ladder phylo = updatePhyloGroups 1
(Map.fromList $ map (\g -> (getGroupId g,g)) $ traceMatchEnd opts $ concat branches) (Map.fromList $ map (\g -> (getGroupId g,g)) $ traceMatchEnd $ concat branches)
(updateQuality quality phylo) (updateQuality quality phylo)
where where
------- -------
...@@ -718,4 +718,4 @@ temporalMatching opts ladder phylo = updatePhyloGroups 1 ...@@ -718,4 +718,4 @@ temporalMatching opts ladder phylo = updatePhyloGroups 1
(getDocsByDate phylo) (getDocsByDate phylo)
(getCoocByDate phylo) (getCoocByDate phylo)
((phylo ^. phylo_foundations) ^. foundations_rootsInGroups) ((phylo ^. phylo_foundations) ^. foundations_rootsInGroups)
(traceTemporalMatching opts $ getGroupsFromScale 1 phylo) (traceTemporalMatching $ getGroupsFromScale 1 phylo)
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