|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.knowceans.dirichlet.lda.LdaGibbsSampler org.knowceans.dirichlet.sandbox.LdaGibbsSamplerHyper
public class LdaGibbsSamplerHyper
Gibbs sampler for estimating the best assignments of topics for words and documents in a corpus. The algorithm is introduced in Tom Griffiths' paper "Gibbs sampling in the generative model of Latent Dirichlet Allocation" (2002).
Field Summary | |
---|---|
(package private) int[] |
alphaParams
|
(package private) InvGammaArms |
alphaSampler
|
(package private) int[] |
betaParams
|
(package private) InvGammaArms |
betaSampler
|
private static long |
serialVersionUID
|
(package private) LdaMarkovStateHyper |
state
|
Fields inherited from class org.knowceans.dirichlet.lda.LdaGibbsSampler |
---|
backupIteration, conf, dispcol, numstats, phisum, rand, thetasum |
Constructor Summary | |
---|---|
LdaGibbsSamplerHyper(ITermCorpus corpus,
ExtLdaConfiguration conf,
java.util.Random rand)
|
|
LdaGibbsSamplerHyper(LdaMarkovStateHyper state,
ExtLdaConfiguration conf,
java.util.Random rand)
|
Method Summary | |
---|---|
private void |
estimateHyperParameters(LdaMarkovStateHyper hyper)
Estimate the hyperparameters from the observations (uses vectorial values) |
private void |
init()
|
private void |
leaveOneOutAlpha(LdaMarkovStateHyper s)
Estimate the parameters alpha based on Minka's leave-one-out likeliho |
private void |
leaveOneOutBeta(LdaMarkovStateHyper s)
Estimate the parameters beta based on Minka's leave-one-out likelihood. |
protected void |
sampleCorpus(LdaMarkovState s)
Sample once through the corpus and update the corresponding state. |
private void |
sampleHyperParameters()
Sample scalar hyperparameters from the observations using adaptive rejective metropolis sampling with rasmussen's vague inverse-gamma prior |
protected int |
sampleLdaFullConditional(LdaMarkovState ms,
int m,
int n)
Sample a topic z_i from the full conditional distribution: p(z_i = j | z_-i, w) = (n_-i,j(w_i) + beta(w_i))/(n_-i,j(.) + sum beta) * (n_-i,j(d_i) + alpha(j))/(n_-i,. |
Methods inherited from class org.knowceans.dirichlet.lda.LdaGibbsSampler |
---|
getPhi, getState, getTheta, gibbs, gibbs, gibbsHeap, gibbsHeap, initialState, load, main, output, run, save, saveState, updateParams, updatePhi, updateTheta, writeParameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
InvGammaArms alphaSampler
InvGammaArms betaSampler
int[] alphaParams
int[] betaParams
LdaMarkovStateHyper state
private static final long serialVersionUID
Constructor Detail |
---|
public LdaGibbsSamplerHyper(ITermCorpus corpus, ExtLdaConfiguration conf, java.util.Random rand)
corpus
- conf
- rand
- public LdaGibbsSamplerHyper(LdaMarkovStateHyper state, ExtLdaConfiguration conf, java.util.Random rand)
state
- conf
- rand
- Method Detail |
---|
private void init()
protected void sampleCorpus(LdaMarkovState s)
LdaGibbsSampler
sampleCorpus
in class LdaGibbsSampler
protected int sampleLdaFullConditional(LdaMarkovState ms, int m, int n)
sampleLdaFullConditional
in class LdaGibbsSampler
m
- documentn
- wordprivate void estimateHyperParameters(LdaMarkovStateHyper hyper)
hyper
- private void leaveOneOutAlpha(LdaMarkovStateHyper s)
s
- od.private void leaveOneOutBeta(LdaMarkovStateHyper s)
s
- private void sampleHyperParameters()
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |