Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
a4639ebd
Commit
a4639ebd
authored
Jan 20, 2017
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DISTRI Distance OPTI] Some comments.
parent
fa610f47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
distances.py
graph/distances.py
+5
-0
graph.py
graph/graph.py
+8
-0
No files found.
graph/distances.py
View file @
a4639ebd
...
...
@@ -141,6 +141,11 @@ def clusterByDistances( cooc_matrix
for
i
in
matrix
.
keys
():
si
=
sum
([
matrix
[
i
][
j
]
for
j
in
matrix
[
i
]
.
keys
()
if
i
!=
j
])
#xx = pd.DataFrame.as_matrix(x)
#np.fill_diagonal(xx,0)
#sii = sum(sum(xx))
for
j
in
matrix
[
i
]
.
keys
():
sj
=
sum
([
matrix
[
j
][
k
]
for
k
in
matrix
[
j
]
.
keys
()
if
j
!=
k
])
if
i
!=
j
:
...
...
graph/graph.py
View file @
a4639ebd
...
...
@@ -16,6 +16,9 @@ from celery import shared_task
from
datetime
import
datetime
# https://docs.python.org/3.1/library/profile.html
#import cProfile
@
shared_task
def
compute_graph
(
corpus_id
=
None
,
cooc_id
=
None
,
field1
=
'ngrams'
,
field2
=
'ngrams'
...
...
@@ -57,6 +60,11 @@ def compute_graph( corpus_id=None , cooc_id=None
print
(
"GRAPH #
%
d ... Clustering with
%
s distance."
%
(
cooc_id
,
distance
))
#cProfile('''clusterByDistances ( cooc_matrix
# , field1="ngrams", field2="ngrams"
# , distance=distance
# )''')
G
,
partition
,
ids
,
weight
=
clusterByDistances
(
cooc_matrix
,
field1
=
"ngrams"
,
field2
=
"ngrams"
,
distance
=
distance
...
...
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