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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
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
1d67e4f0
Commit
1d67e4f0
authored
Mar 04, 2024
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Order1 with test fixed
parent
fb436075
Pipeline
#5703
failed with stages
in 80 minutes and 54 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
25 deletions
+58
-25
gargantext.cabal
gargantext.cabal
+5
-5
Utils.hs
src/Gargantext/Core/Methods/Matrix/Accelerate/Utils.hs
+1
-1
Conditional.hs
...ntext/Core/Methods/Similarities/Accelerate/Conditional.hs
+12
-15
Conditional.hs
src/Gargantext/Core/Methods/Similarities/Conditional.hs
+15
-4
Similarity.hs
test/Test/Core/Similarity.hs
+22
-0
Main.hs
test/drivers/tasty/Main.hs
+3
-0
No files found.
gargantext.cabal
View file @
1d67e4f0
...
...
@@ -130,6 +130,7 @@ library
Gargantext.Core
Gargantext.Core.Mail.Types
Gargantext.Core.Methods.Similarities
Gargantext.Core.Methods.Similarities.Conditional
Gargantext.Core.NLP
Gargantext.Core.NodeStory
Gargantext.Core.NodeStory.DB
...
...
@@ -256,8 +257,8 @@ library
Gargantext.API.Node.Corpus.Searx
Gargantext.API.Node.Document.Export
Gargantext.API.Node.Document.Export.Types
Gargantext.API.Node.DocumentsFromWriteNodes
Gargantext.API.Node.DocumentUpload
Gargantext.API.Node.DocumentsFromWriteNodes
Gargantext.API.Node.FrameCalcUpload
Gargantext.API.Node.Get
Gargantext.API.Node.New
...
...
@@ -280,7 +281,6 @@ library
Gargantext.Core.Methods.Similarities.Accelerate.Conditional
Gargantext.Core.Methods.Similarities.Accelerate.Distributional
Gargantext.Core.Methods.Similarities.Accelerate.SpeGen
Gargantext.Core.Methods.Similarities.Conditional
Gargantext.Core.Methods.Similarities.Distributional
Gargantext.Core.Statistics
Gargantext.Core.Text.Convert
...
...
@@ -300,10 +300,10 @@ library
Gargantext.Core.Text.Corpus.Parsers.RIS
Gargantext.Core.Text.Corpus.Parsers.RIS.Presse
Gargantext.Core.Text.Corpus.Parsers.Telegram
Gargantext.Core.Text.Corpus.Parsers.WOS
Gargantext.Core.Text.Corpus.Parsers.Wikidata
Gargantext.Core.Text.Corpus.Parsers.Wikidata.Crawler
Gargantext.Core.Text.Corpus.Parsers.Wikimedia
Gargantext.Core.Text.Corpus.Parsers.WOS
Gargantext.Core.Text.Learn
Gargantext.Core.Text.List
Gargantext.Core.Text.List.Group
...
...
@@ -402,12 +402,12 @@ library
Gargantext.Database.Query.Table.Node.Select
Gargantext.Database.Query.Table.Node.Update
Gargantext.Database.Query.Table.Node.User
Gargantext.Database.Query.Table.Node_NodeNgramsNodeNgrams
Gargantext.Database.Query.Table.NodeContext
Gargantext.Database.Query.Table.NodeContext_NodeContext
Gargantext.Database.Query.Table.NodeNgrams
Gargantext.Database.Query.Table.NodeNode
Gargantext.Database.Query.Table.NodeNodeNgrams
Gargantext.Database.Query.Table.Node_NodeNgramsNodeNgrams
Gargantext.Database.Query.Table.NodesNgramsRepo
Gargantext.Database.Query.Tree
Gargantext.Database.Query.Tree.Error
...
...
@@ -415,13 +415,13 @@ library
Gargantext.Database.Schema.ContextNodeNgrams
Gargantext.Database.Schema.ContextNodeNgrams2
Gargantext.Database.Schema.NgramsPostag
Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams
Gargantext.Database.Schema.NodeContext
Gargantext.Database.Schema.NodeContext_NodeContext
Gargantext.Database.Schema.NodeNgrams
Gargantext.Database.Schema.NodeNode
Gargantext.Database.Schema.NodeNodeNgrams
Gargantext.Database.Schema.NodeNodeNgrams2
Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams
Gargantext.Database.Schema.NodesNgramsRepo
Gargantext.Database.Schema.Prelude
Gargantext.Database.Types
...
...
src/Gargantext/Core/Methods/Matrix/Accelerate/Utils.hs
View file @
1d67e4f0
...
...
@@ -125,7 +125,7 @@ matrixEye n' =
diagNull
::
Num
a
=>
Dim
->
Acc
(
Matrix
a
)
->
Acc
(
Matrix
a
)
diagNull
n
m
=
trace
(
"diagNull"
)
$
zipWith
(
*
)
m
(
matrixEye
n
)
diagNull
n
m
=
zipWith
(
*
)
m
(
matrixEye
n
)
-- Returns an N-dimensional array with the values of x for the indices where
...
...
src/Gargantext/Core/Methods/Similarities/Accelerate/Conditional.hs
View file @
1d67e4f0
...
...
@@ -53,26 +53,23 @@ measureConditional :: Matrix Int -> Matrix Double
measureConditional
m
=
run
$
x
$
map
fromIntegral
$
use
m
where
x
::
Acc
(
Matrix
Double
)
->
Acc
(
Matrix
Double
)
x
mat
=
diagNull
r
$
divByDiag
r
mat
x
mat
=
maxOnly
$
diagNull
r
$
divByDiag
r
mat
r
::
Dim
r
=
dim
m
_maxOnly
::
Elt
e
=>
Acc
(
SymetricMatrix
e
)
->
Acc
(
Matrix
e
)
_maxOnly
m'
=
backpermute
(
shape
m'
)
(
lift1
(
\
(
Z
:.
(
i
::
Exp
Int
)
:.
(
j
::
Exp
Int
))
->
let
ij
=
lift
(
Z
:.
i
:.
j
)
ji
=
lift
(
Z
:.
j
:.
i
)
in
((
ifThenElse
(
ij
<
ji
)
ji
0
)
::
Exp
DIM2
)
)
)
m'
-- Maybe we should use backpermute to accelerate it (no need to access to cells then
maxOnly
::
Acc
(
SymetricMatrix
Double
)
->
Acc
(
Matrix
Double
)
maxOnly
m'
=
generate
(
shape
m'
)
((
\
coord
->
let
(
Z
:.
(
i
::
Exp
Int
)
:.
(
j
::
Exp
Int
))
=
unlift
coord
ij
=
m'
!
(
lift
$
(
Z
:.
i
:.
j
))
ji
=
m'
!
(
lift
$
(
Z
:.
j
:.
i
))
in
ifThenElse
(
ij
>
ji
)
ij
(
constant
0
)
)
)
-- This function should be removed
measureConditional'
::
Matrix
Int
->
Matrix
Double
measureConditional'
m
=
run
$
x
$
map
fromIntegral
$
use
m
where
...
...
src/Gargantext/Core/Methods/Similarities/Conditional.hs
View file @
1d67e4f0
...
...
@@ -55,12 +55,23 @@ conditional m' = Map.fromList $ ((catMaybes results') `using` parList rdeepseq)
keys
=
Set
.
toList
$
Set
.
fromList
(
x
<>
y
)
(
x
,
y
)
=
unzip
$
Map
.
keys
m
{-
Only for TESTs
-}
conditional_test
::
Bool
conditional_test
=
conditional_test1
==
conditional_test2
conditional_test1
::
HashMap
(
Text
,
Text
)
Double
conditional_test1
=
conditional
$
Map
.
fromList
example_matrix
conditional_test
::
HashMap
(
Text
,
Text
)
Double
conditional_test
=
conditional
$
Map
.
fromList
example_matrix
conditional_test2
::
HashMap
(
Text
,
Text
)
Double
conditional_test2
=
Map
.
fromList
$
M
.
toList
$
M
.
filter
(
>
0
)
$
score
Square
measureConditional
$
M
.
fromList
example_matrix
conditional_test'
::
M
.
Map
(
Text
,
Text
)
Double
conditional_test'
=
M
.
filter
(
>
0
)
$
score
Square
measureConditional
$
M
.
fromList
example_matrix
example_matrix
::
[((
Text
,
Text
),
Int
)]
example_matrix
=
concat
[
...
...
test/Test/Core/Similarity.hs
0 → 100644
View file @
1d67e4f0
{-|
Module : Core.Similarity
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
module
Test.Core.Similarity
where
import
Gargantext.Core.Methods.Similarities.Conditional
import
Gargantext.Prelude
import
Test.Hspec
test
::
Spec
test
=
do
describe
"check if similarities optimizations are well implemented"
$
do
it
"Conditional"
$
do
conditional_test
`
shouldBe
`
True
test/drivers/tasty/Main.hs
View file @
1d67e4f0
...
...
@@ -14,6 +14,7 @@ import Gargantext.Prelude
import
qualified
Test.Core.Text.Corpus.Query
as
CorpusQuery
import
qualified
Test.Core.Utils
as
Utils
import
qualified
Test.Core.Similarity
as
Similarity
import
qualified
Test.Graph.Clustering
as
Graph
import
qualified
Test.Ngrams.NLP
as
NLP
import
qualified
Test.Ngrams.Query
as
NgramsQuery
...
...
@@ -36,6 +37,7 @@ main = do
cryptoSpec
<-
testSpec
"Crypto"
Crypto
.
test
nlpSpec
<-
testSpec
"NLP"
NLP
.
test
jobsSpec
<-
testSpec
"Jobs"
Jobs
.
test
similaritySpec
<-
testSpec
"Similarity"
Similarity
.
test
defaultMain
$
testGroup
"Gargantext"
[
utilSpec
...
...
@@ -50,4 +52,5 @@ main = do
,
JSON
.
tests
,
Errors
.
tests
,
Phylo
.
tests
,
similaritySpec
]
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