Skip to content

Instantly share code, notes, and snippets.

@myui
Last active April 29, 2017 20:36
Show Gist options
  • Save myui/5a05bc8e2c905f31f3d6e496a06282eb to your computer and use it in GitHub Desktop.
Save myui/5a05bc8e2c905f31f3d6e496a06282eb to your computer and use it in GitHub Desktop.
-- fitting
select
label, word, avg(lambda) as lambda
from (
select
train_lda(feature, "-topic 2 -iter 20")
as (label, word, lambda)
from
data
) t1
group by label, word;
-- prediction
select
t.docid,
lda_predict(
t.word, t.value, m.label, m.lambda,
"-topic 2"
) as probabilities
from
test t
JOIN lda_model m ON (t.word = m.word)
group by
t.docid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment