Skip to content

Instantly share code, notes, and snippets.

@PMeinshausen
Created September 29, 2014 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PMeinshausen/f4878b103522165a9c3e to your computer and use it in GitHub Desktop.
Save PMeinshausen/f4878b103522165a9c3e to your computer and use it in GitHub Desktop.
--Syntax
SELECT * FROM TF_IDF(
ON TF
(
ON {table|view|(query)} PARTITION BY docid
[FORMULA('bool'|'log'|'augment'|'normal')]
) AS TF PARTITION BY term
[ON (SELECT term, COUNT(distinct docid) FROM input_table
GROUP BY term) AS docperterm PARTITION BY term]
[ON (SELECT COUNT(distinct(docid)) FROM input_table)
AS doccount dimension]
[ON (SELECT DISTINCT(term) as term,
IDF FROM tf_idf_output_table) AS IDF PARTITION BY term]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment