Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
1d02438b
Commit
1d02438b
authored
Nov 09, 2020
by
qlobbe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parent
86c6ae7f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
Main.hs
bin/gargantext-adaptative-phylo/Main.hs
+2
-2
Tools.hs
src/Gargantext/Core/Viz/Graph/Tools.hs
+1
-1
TemporalMatching.hs
src/Gargantext/Core/Viz/Phylo/TemporalMatching.hs
+17
-9
No files found.
bin/gargantext-adaptative-phylo/Main.hs
View file @
1d02438b
...
...
@@ -18,8 +18,8 @@ module Main where
import
Data.Aeson
import
Data.ByteString.Lazy
(
ByteString
)
import
Data.Maybe
(
isJust
,
fromJust
)
import
Data.List
(
concat
,
nub
,
isSuffixOf
,
take
)
--
import Data.Maybe (isJust, fromJust)
import
Data.List
(
concat
,
nub
,
isSuffixOf
)
import
Data.String
(
String
)
import
Data.Text
(
Text
,
unwords
,
unpack
)
...
...
src/Gargantext/Core/Viz/Graph/Tools.hs
View file @
1d02438b
...
...
@@ -47,7 +47,7 @@ cooc2graph' distance threshold myCooc = distanceMap
where
(
ti
,
_
)
=
createIndices
myCooc
myCooc'
=
toIndex
ti
myCooc
matCooc
=
map2mat
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
0
)
myCooc'
matCooc
=
map2mat
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
1
)
myCooc'
distanceMat
=
measure
distance
matCooc
distanceMap
=
Map
.
filter
(
>
threshold
)
$
mat2map
distanceMat
...
...
src/Gargantext/Core/Viz/Phylo/TemporalMatching.hs
View file @
1d02438b
...
...
@@ -257,18 +257,21 @@ relevantBranches :: Int -> [[PhyloGroup]] -> [[PhyloGroup]]
relevantBranches
term
branches
=
filter
(
\
groups
->
(
any
(
\
group
->
elem
term
$
group
^.
phylo_groupNgrams
)
groups
))
branches
accuracy
::
Int
->
[
PhyloGroup
]
->
Double
accuracy
x
bk
=
((
fromIntegral
$
length
$
filter
(
\
g
->
elem
x
$
g
^.
phylo_groupNgrams
)
bk
)
/
(
fromIntegral
$
length
bk
))
accuracy
::
Int
->
[(
Date
,
Date
)]
->
[
PhyloGroup
]
->
Double
accuracy
x
periods
bk
=
((
fromIntegral
$
length
$
filter
(
\
g
->
elem
x
$
g
^.
phylo_groupNgrams
)
bk'
)
/
(
fromIntegral
$
length
bk'
))
where
bk'
::
[
PhyloGroup
]
bk'
=
filter
(
\
g
->
elem
(
g
^.
phylo_groupPeriod
)
periods
)
bk
recall
::
Int
->
[
PhyloGroup
]
->
[[
PhyloGroup
]]
->
Double
recall
x
bk
bx
=
((
fromIntegral
$
length
$
filter
(
\
g
->
elem
x
$
g
^.
phylo_groupNgrams
)
bk
)
/
(
fromIntegral
$
length
$
filter
(
\
g
->
elem
x
$
g
^.
phylo_groupNgrams
)
$
concat
bx
))
fScore
::
Double
->
Int
->
[
PhyloGroup
]
->
[[
PhyloGroup
]]
->
Double
fScore
beta
x
bk
bx
=
fScore
::
Double
->
Int
->
[
(
Date
,
Date
)]
->
[
PhyloGroup
]
->
[[
PhyloGroup
]]
->
Double
fScore
beta
x
periods
bk
bx
=
let
rec
=
recall
x
bk
bx
acc
=
accuracy
x
bk
acc
=
accuracy
x
periods
bk
in
((
1
+
beta
**
2
)
*
acc
*
rec
)
/
(((
beta
**
2
)
*
rec
+
acc
))
...
...
@@ -284,7 +287,8 @@ toPhyloQuality' beta freq branches =
else
sum
$
map
(
\
i
->
let
bks
=
relevantBranches
i
branches
in
(
freq
!
i
)
*
(
sum
$
map
(
\
bk
->
((
wk
bk
)
/
(
sum
$
map
wk
bks
))
*
(
fScore
beta
i
bk
bks
))
bks
))
periods
=
nub
$
map
_phylo_groupPeriod
$
concat
bks
in
(
freq
!
i
)
*
(
sum
$
map
(
\
bk
->
((
wk
bk
)
/
(
sum
$
map
wk
bks
))
*
(
fScore
beta
i
periods
bk
bks
))
bks
))
$
keys
freq
toRecall
::
Map
Int
Double
->
[[
PhyloGroup
]]
->
Double
...
...
@@ -311,8 +315,10 @@ toAccuracy freq branches =
$
map
(
\
x
->
let
px
=
freq
!
x
bx
=
relevantBranches
x
branches
-- | periods containing x
periods
=
nub
$
map
_phylo_groupPeriod
$
concat
bx
wks
=
sum
$
map
wk
bx
in
(
px
/
pys
)
*
(
sum
$
map
(
\
bk
->
((
wk
bk
)
/
wks
)
*
(
accuracy
x
bk
))
bx
))
in
(
px
/
pys
)
*
(
sum
$
map
(
\
bk
->
((
wk
bk
)
/
wks
)
*
(
accuracy
x
periods
bk
))
bx
))
$
keys
freq
where
pys
::
Double
...
...
@@ -328,8 +334,10 @@ toPhyloQuality beta freq branches =
$
map
(
\
x
->
let
px
=
freq
!
x
bx
=
relevantBranches
x
branches
-- | periods containing x
periods
=
nub
$
map
_phylo_groupPeriod
$
concat
bx
wks
=
sum
$
map
wk
bx
in
(
px
/
pys
)
*
(
sum
$
map
(
\
bk
->
((
wk
bk
)
/
wks
)
*
(
fScore
beta
x
bk
bx
))
bx
))
in
(
px
/
pys
)
*
(
sum
$
map
(
\
bk
->
((
wk
bk
)
/
wks
)
*
(
fScore
beta
x
periods
bk
bx
))
bx
))
$
keys
freq
where
pys
::
Double
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment