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
196
Issues
196
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
bdb12f4e
Commit
bdb12f4e
authored
Nov 19, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-wikidata
parents
ef412f0b
233f89cc
Pipeline
#2120
failed with stage
in 10 minutes and 30 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
package.yaml
package.yaml
+1
-1
Distances.hs
src/Gargantext/Core/Methods/Distances.hs
+3
-3
Distributional.hs
...ntext/Core/Methods/Distances/Accelerate/Distributional.hs
+4
-2
API.hs
src/Gargantext/Core/Viz/Graph/API.hs
+2
-2
No files found.
package.yaml
View file @
bdb12f4e
name
:
gargantext
name
:
gargantext
version
:
'
0.0.4.8'
version
:
'
0.0.4.8
.1
'
synopsis
:
Search, map, share
synopsis
:
Search, map, share
description
:
Please see README.md
description
:
Please see README.md
category
:
Data
category
:
Data
...
...
src/Gargantext/Core/Methods/Distances.hs
View file @
bdb12f4e
...
@@ -14,21 +14,21 @@ Portability : POSIX
...
@@ -14,21 +14,21 @@ Portability : POSIX
module
Gargantext.Core.Methods.Distances
module
Gargantext.Core.Methods.Distances
where
where
-- import Debug.Trace (trace)
import
Data.Aeson
import
Data.Aeson
import
Data.Array.Accelerate
(
Matrix
)
import
Data.Array.Accelerate
(
Matrix
)
import
Data.Swagger
import
Data.Swagger
import
GHC.Generics
(
Generic
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Core.Methods.Distances.Accelerate.Conditional
(
measureConditional
)
import
Gargantext.Core.Methods.Distances.Accelerate.Conditional
(
measureConditional
)
import
Gargantext.Core.Methods.Distances.Accelerate.Distributional
(
logDistributional
)
import
Gargantext.Core.Methods.Distances.Accelerate.Distributional
(
logDistributional
)
import
Gargantext.Prelude
(
Ord
,
Eq
,
Int
,
Double
)
import
Gargantext.Prelude
(
Ord
,
Eq
,
Int
,
Double
,
Show
{-, ($), show-}
)
import
Gargantext.Prelude
(
Show
)
import
Prelude
(
Enum
,
Bounded
,
minBound
,
maxBound
)
import
Prelude
(
Enum
,
Bounded
,
minBound
,
maxBound
)
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
import
Test.QuickCheck.Arbitrary
------------------------------------------------------------------------
------------------------------------------------------------------------
data
Distance
=
Conditional
|
Distributional
data
Distance
=
Conditional
|
Distributional
deriving
(
Show
)
deriving
(
Show
,
Eq
)
measure
::
Distance
->
Matrix
Int
->
Matrix
Double
measure
::
Distance
->
Matrix
Int
->
Matrix
Double
measure
Conditional
=
measureConditional
measure
Conditional
=
measureConditional
...
...
src/Gargantext/Core/Methods/Distances/Accelerate/Distributional.hs
View file @
bdb12f4e
...
@@ -126,6 +126,8 @@ logDistributional m = run
...
@@ -126,6 +126,8 @@ logDistributional m = run
logDistributional'
::
Int
->
Matrix
Int
->
Acc
(
Matrix
Double
)
logDistributional'
::
Int
->
Matrix
Int
->
Acc
(
Matrix
Double
)
logDistributional'
n
m'
=
result
logDistributional'
n
m'
=
result
where
where
-- From Matrix Int to Matrix Double, i.e :
-- m :: Matrix Int -> Matrix Double
m
=
map
fromIntegral
$
use
m'
m
=
map
fromIntegral
$
use
m'
-- Scalar. Sum of all elements of m.
-- Scalar. Sum of all elements of m.
...
@@ -137,9 +139,9 @@ logDistributional' n m' = result
...
@@ -137,9 +139,9 @@ logDistributional' n m' = result
-- Size n vector. s = [s_i]_i
-- Size n vector. s = [s_i]_i
s
=
sum
((
.-
)
m
d_m
)
s
=
sum
((
.-
)
m
d_m
)
-- Matrix nxn. Vector s replicated as rows.
-- Matrix nxn. Vector s replicated as rows.
s_1
=
replicate
(
constant
(
Z
:.
All
:.
n
))
s
s_1
=
replicate
(
constant
(
Z
:.
All
:.
n
))
s
-- Matrix nxn. Vector s replicated as columns.
-- Matrix nxn. Vector s replicated as columns.
s_2
=
replicate
(
constant
(
Z
:.
n
:.
All
))
s
s_2
=
replicate
(
constant
(
Z
:.
n
:.
All
))
s
-- Matrix nxn. ss = [s_i * s_j]_{i,j}. Outer product of s with itself.
-- Matrix nxn. ss = [s_i * s_j]_{i,j}. Outer product of s with itself.
...
...
src/Gargantext/Core/Viz/Graph/API.hs
View file @
bdb12f4e
...
@@ -180,8 +180,8 @@ computeGraph cId d nt repo = do
...
@@ -180,8 +180,8 @@ computeGraph cId d nt repo = do
let
ngs
=
filterListWithRoot
MapTerm
let
ngs
=
filterListWithRoot
MapTerm
$
mapTermListRoot
[
lId
]
nt
repo
$
mapTermListRoot
[
lId
]
nt
repo
myCooc
<-
HashMap
.
filter
(
>
2
)
-- Removing the hapax (ngrams with 1 cooc)
myCooc
<-
HashMap
.
filter
(
>
1
)
-- Removing the hapax (ngrams with 1 cooc)
<$>
getCoocByNgrams
(
Diagonal
Tru
e
)
<$>
getCoocByNgrams
(
if
d
==
Conditional
then
Diagonal
True
else
Diagonal
Fals
e
)
<$>
groupNodesByNgrams
ngs
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
...
...
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