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
cf3c1b70
Commit
cf3c1b70
authored
Dec 09, 2015
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] removing random for global tfidf.
parent
7947aa5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
tfidf.py
ngram/tfidf.py
+6
-4
No files found.
ngram/tfidf.py
View file @
cf3c1b70
...
...
@@ -119,14 +119,16 @@ def compute_tfidf(corpus):
# the end!
db
.
commit
()
#http://stackoverflow.com/questions/8674718/best-way-to-select-random-rows-postgresql
def
compute_tfidf_global
(
corpus
):
'''
Maybe improve this with:
#http://stackoverflow.com/questions/8674718/best-way-to-select-random-rows-postgresql
'''
dbg
=
DebugTime
(
'Corpus #
%
d - tfidf global'
%
corpus
.
id
)
dbg
.
show
(
'calculate terms frequencies sums'
)
tfidf_node
=
get_or_create_node
(
nodetype
=
'Tfidf (global)'
,
corpus
=
corpus
)
# update would be better
session
.
query
(
NodeNodeNgram
)
.
filter
(
NodeNodeNgram
.
nodex_id
==
tfidf_node
.
id
)
.
delete
()
session
.
commit
()
...
...
@@ -215,7 +217,7 @@ def compute_tfidf_global(corpus):
%
s as corpus ON corpus.id = doc.parent_id
WHERE
corpus.language_id =
%
d AND doc.type_id =
%
d AND corpus.type_id=
%
d
AND RANDOM() < 0.01
--
AND RANDOM() < 0.01
GROUP BY
node_ngram.ngram_id
-- limit 10000
...
...
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