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
11
Merge Requests
11
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
cccc2f75
Commit
cccc2f75
authored
Jun 09, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN] code kmeans.
parent
8255d8e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
Metrics.hs
src/Gargantext/Text/Metrics.hs
+5
-2
No files found.
src/Gargantext/Text/Metrics.hs
View file @
cccc2f75
...
@@ -66,11 +66,14 @@ type BinSize = Double
...
@@ -66,11 +66,14 @@ type BinSize = Double
takeSome
::
Ord
t
=>
ListSize
->
BinSize
->
[
Scored
t
]
->
[
Scored
t
]
takeSome
::
Ord
t
=>
ListSize
->
BinSize
->
[
Scored
t
]
->
[
Scored
t
]
takeSome
l
s
scores
=
L
.
take
l
takeSome
l
s
scores
=
L
.
take
l
$
takeSample
n
m
$
takeSample
n
m
$
take
Kmeans
2
scores
$
split
Kmeans
2
scores
where
where
-- TODO : KMEAN split into 2 main clusters
-- TODO : KMEAN split into 2 main clusters
-- (TODO: benchmark with accelerate-example kmeans version)
-- (TODO: benchmark with accelerate-example kmeans version)
takeKmeans
x
xs
=
elements
$
V
.
head
$
kmeans
(
\
i
->
VU
.
fromList
([(
_scored_incExc
i
::
Double
)]))
euclidSq
x
xs
splitKmeans
x
xs
=
elements
$
V
.
head
$
kmeans
(
\
i
->
VU
.
fromList
([(
_scored_incExc
i
::
Double
)]))
euclidSq
x
xs
n
=
round
((
fromIntegral
l
)
/
s
)
n
=
round
((
fromIntegral
l
)
/
s
)
m
=
round
$
(
fromIntegral
$
length
scores
)
/
(
s
)
m
=
round
$
(
fromIntegral
$
length
scores
)
/
(
s
)
takeSample
n
m
xs
=
L
.
concat
$
map
(
L
.
take
n
)
takeSample
n
m
xs
=
L
.
concat
$
map
(
L
.
take
n
)
...
...
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