Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
165
Issues
165
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
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
gargantext
haskell-gargantext
Commits
bfe7d274
Commit
bfe7d274
authored
Jun 08, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Terms Selection] takeSome function which filters with inclusion/exclusion (relevance) and gen/spe.
parent
b5124f1e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
15 deletions
+38
-15
.gitignore
.gitignore
+1
-2
Metrics.hs
src/Gargantext/Text/Metrics.hs
+35
-11
stack.yaml
stack.yaml
+2
-2
No files found.
.gitignore
View file @
bfe7d274
...
@@ -4,6 +4,5 @@
...
@@ -4,6 +4,5 @@
*purescript-gargantext
*purescript-gargantext
doc
doc
bin
bin
clustering-louvain
deps
profiling
profiling
servant-job
src/Gargantext/Text/Metrics.hs
View file @
bfe7d274
...
@@ -46,10 +46,11 @@ import Gargantext.Text.Context (splitBy, SplitContext(Sentences))
...
@@ -46,10 +46,11 @@ import Gargantext.Text.Context (splitBy, SplitContext(Sentences))
import
Gargantext.Viz.Graph.Distances.Matrice
import
Gargantext.Viz.Graph.Distances.Matrice
import
Gargantext.Viz.Graph.Index
import
Gargantext.Viz.Graph.Index
import
qualified
Data.Array.Accelerate.Interpreter
as
DAA
import
qualified
Data.Array.Accelerate
as
DAA
import
GHC.Real
(
round
)
-- ord relevance: top n plus inclus
-- échantillonnage de généricity
--
--filterCooc :: Ord t => Map (t, t) Int -> Map (t, t) Int
--filterCooc :: Ord t => Map (t, t) Int -> Map (t, t) Int
--filterCooc m =
--filterCooc m =
---- filterCooc m = foldl (\k -> maybe (panic "no key") identity $ M.lookup k m) M.empty selection
---- filterCooc m = foldl (\k -> maybe (panic "no key") identity $ M.lookup k m) M.empty selection
...
@@ -57,16 +58,39 @@ import Gargantext.Viz.Graph.Index
...
@@ -57,16 +58,39 @@ import Gargantext.Viz.Graph.Index
-- . fromIndex fi $ filterMat $ cooc2mat ti m
-- . fromIndex fi $ filterMat $ cooc2mat ti m
import
Data.Array.Accelerate
(
Matrix
)
type
ListSize
=
Int
type
BinSize
=
Double
filterMat
::
Matrix
Int
->
[(
Index
,
Index
)]
takeSome
::
Ord
t
=>
ListSize
->
BinSize
->
[
Scored
t
]
->
[
Scored
t
]
filterMat
m
=
S
.
toList
$
S
.
take
n
$
S
.
fromList
$
(
L
.
take
nIe
incExc'
)
<>
(
L
.
take
nSg
speGen'
)
takeSome
l
s
scores
=
L
.
take
l
$
takeSample
n
m
$
takeKmeans
l'
$
L
.
reverse
$
L
.
sortOn
_scored_incExc
scores
where
where
(
incExc'
,
speGen'
)
=
both
(
map
fst
.
L
.
sortOn
snd
.
M
.
toList
.
mat2map
)
(
conditional'
m
)
-- TODO : KMEAN split into 2 main clusters
n
=
nIe
+
nSg
-- (advice: use accelerate-example kmeans version
nIe
=
30
-- and maybe benchmark it to be sure)
nSg
=
70
takeKmeans
=
L
.
take
l'
=
4000
n
=
round
((
fromIntegral
l
)
/
s
)
m
=
round
$
(
fromIntegral
$
length
scores
)
/
(
s
)
takeSample
n
m
xs
=
L
.
concat
$
map
(
L
.
take
n
)
$
L
.
reverse
$
map
(
L
.
sortOn
_scored_incExc
)
$
splitEvery
m
$
L
.
reverse
$
L
.
sortOn
_scored_speGen
xs
data
Scored
t
=
Scored
{
_scored_terms
::
t
,
_scored_incExc
::
InclusionExclusion
,
_scored_speGen
::
SpecificityGenericity
}
deriving
(
Show
)
incExcSpeGen_sorted'
::
Ord
t
=>
Map
(
t
,
t
)
Int
->
[
Scored
t
]
incExcSpeGen_sorted'
m
=
zipWith
(
\
(
i
,
t
)
(
inc
,
spe
)
->
Scored
t
inc
spe
)
(
M
.
toList
fi
)
scores
where
(
ti
,
fi
)
=
createIndices
m
(
is
,
ss
)
=
incExcSpeGen
$
cooc2mat
ti
m
scores
=
DAA
.
toList
$
DAA
.
run
$
DAA
.
zip
(
DAA
.
use
is
)
(
DAA
.
use
ss
)
incExcSpeGen_sorted
::
Ord
t
=>
Map
(
t
,
t
)
Int
->
([(
t
,
Double
)],[(
t
,
Double
)])
incExcSpeGen_sorted
::
Ord
t
=>
Map
(
t
,
t
)
Int
->
([(
t
,
Double
)],[(
t
,
Double
)])
...
...
stack.yaml
View file @
bfe7d274
...
@@ -2,8 +2,8 @@ flags: {}
...
@@ -2,8 +2,8 @@ flags: {}
extra-package-dbs
:
[]
extra-package-dbs
:
[]
packages
:
packages
:
-
.
-
.
-
servant-job
-
'
deps/servant-job'
-
clustering-louvain
-
'
deps/clustering-louvain'
allow-newer
:
true
allow-newer
:
true
extra-deps
:
extra-deps
:
...
...
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