13. LDA(latent dirichlet
allocation)
●
●
Stan code(manual 128 page)
parameters {
simplex[K] theta[M]; // topic dist for
doc m
simplex[V] phi[K]; // word dist for topic
k
}
model {
for (m in 1:M)
theta[m] ~ dirichlet(alpha); // prior
for (k in 1:K)
phi[k] ~ dirichlet(beta); // prior
for (n in 1:N) {
real gamma[K];
for (k in 1:K)
gamma[k]<-log(theta[doc[n],k])
+log(phi[k,w[n]]);
increment_log_prob(log_sum_exp(gamma));
}
潜在変数zのCategorical 分布は直接使えない
(http://xiangze.hatenablog.com/entry/2013/12/19/013557)
13
25. 余談: 生態学における中立
理論
●
●
Ewens distribution
A unified theory of biogeography and relative species abundance and
its application to tropical rain forests and coral reefs
http://www3.botany.ubc.ca/vellend/COM_ECOL/Hubbell_CoralReefs97.pdf
25