|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knowceans.dirichlet.lda.LdaGibbsSampler
org.knowceans.dirichlet.atm.AtmGibbsSampler
public class AtmGibbsSampler
Gibbs sampler for estimating the best assignments of topics for words and authors of documents in a corpus. The algorithm is introduced in Steyvers, M.; Smyth, P.; Rosen-Zvi, M. & Griffiths, T. "Probabilistic Author-Topic models for information discovery". Proc. ACM SIGKDD, 2004.
| Field Summary | |
|---|---|
protected AtmMarkovState |
atmstate
State variables of the Lda gibbs sampler. |
private static long |
serialVersionUID
|
| Fields inherited from class org.knowceans.dirichlet.lda.LdaGibbsSampler |
|---|
backupIteration, conf, dispcol, numstats, phisum, rand, state, thetasum |
| Constructor Summary | |
|---|---|
protected |
AtmGibbsSampler()
For subclasses who know what they do... |
|
AtmGibbsSampler(AmqCorpus corpus,
AtmMarkovState state,
ExtLdaConfiguration conf,
java.util.Random rand)
Initialise the sampler with an existing state. |
|
AtmGibbsSampler(AmqCorpus corpus,
ExtLdaConfiguration conf)
Initialise the corpus with |
|
AtmGibbsSampler(AmqCorpus corpus,
ExtLdaConfiguration conf,
java.util.Random rand)
Initialise the corpus with |
protected |
AtmGibbsSampler(AtmMarkovState state,
ExtLdaConfiguration conf,
java.util.Random rand)
Initialise the sampler with an existing state. |
|
AtmGibbsSampler(int[][] documents,
int V,
int[][] authors,
int A,
double alpha,
double beta,
int K,
int iterations)
Initialise the Gibbs sampler with data and standard values. |
| Method Summary | |
|---|---|
AtmMarkovState |
getState()
Get the current state of the markov chain. |
protected void |
gibbs()
Main method: Select initial state ? |
int[][] |
gibbsAtm(int[][] w,
int V,
int[][] ad,
int A,
int[][] z,
int K,
int[][] x,
double alpha,
double beta,
int iter)
Native implementation of the Gibbs sampling procedure. |
void |
gibbsAtmHeap(AtmMarkovState s,
ExtLdaConfiguration c)
Native gibbs sampling on the jvm heap |
int[][] |
gibbsAtmHeap(int[][] w,
int[][] ad,
int[][] z,
int[][] x,
int[][] nw,
int[] nwsum,
int[][] nd,
int[] ndsum,
double alpha,
double beta,
int iter)
Native gibbs sampling on the jvm heap. |
protected void |
initialState()
Initialisation: Random assignments with equal probabilities |
static void |
main(java.lang.String[] args)
|
void |
run()
Run the sampler after initialisation. |
protected int[] |
sampleAtmFullConditional(AtmMarkovState s,
int m,
int n)
Sample an actor--topic pair (x_i, z_i) from the full conditional distribution: p(x_i = q,z_i = j|z_-i, w, x_i, a_d, r_d) = (cwt_mj + beta)/(cwtsum_j + W * beta) * (cat_qjr + alpha)/(catsum_qr + K * alpha) |
protected void |
sampleCorpus(AtmMarkovState s)
Sample once through the corpus and update the corresponding state. |
void |
saveState(java.lang.String file)
Saves the current state of the markov chain and the parameters to a file. |
| Methods inherited from class org.knowceans.dirichlet.lda.LdaGibbsSampler |
|---|
getPhi, getTheta, gibbs, gibbsHeap, gibbsHeap, load, output, sampleCorpus, sampleLdaFullConditional, save, updateParams, updatePhi, updateTheta, writeParameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
protected AtmMarkovState atmstate
| Constructor Detail |
|---|
protected AtmGibbsSampler()
public AtmGibbsSampler(int[][] documents,
int V,
int[][] authors,
int A,
double alpha,
double beta,
int K,
int iterations)
documents - V - authors - A - alpha - beta - K - iterations -
public AtmGibbsSampler(AmqCorpus corpus,
ExtLdaConfiguration conf)
corpus - conf -
public AtmGibbsSampler(AmqCorpus corpus,
ExtLdaConfiguration conf,
java.util.Random rand)
corpus - conf - rand -
protected AtmGibbsSampler(AtmMarkovState state,
ExtLdaConfiguration conf,
java.util.Random rand)
corpus - conf - rand -
public AtmGibbsSampler(AmqCorpus corpus,
AtmMarkovState state,
ExtLdaConfiguration conf,
java.util.Random rand)
corpus - state - conf - rand - | Method Detail |
|---|
protected void initialState()
initialState in class LdaGibbsSamplerpublic void run()
run in class LdaGibbsSamplerprotected void gibbs()
gibbs in class LdaGibbsSampler
public int[][] gibbsAtm(int[][] w,
int V,
int[][] ad,
int A,
int[][] z,
int K,
int[][] x,
double alpha,
double beta,
int iter)
w - wordsV - vocabulary sizead - author document associationsA - author countz - topic word associationsK - tobic countx - author word associationsalpha - beta - iter -
public int[][] gibbsAtmHeap(int[][] w,
int[][] ad,
int[][] z,
int[][] x,
int[][] nw,
int[] nwsum,
int[][] nd,
int[] ndsum,
double alpha,
double beta,
int iter)
w - [in] wordsad - [in] document authorsz - [in/out] topic associationsx - [in/out] author word associationsnw - [in/out] topic-word countsnwsum - [in/out] summed topic-word counts (total words per topic)nd - [in/out] author-topic countsndsum - [in] author words (total words per author)alpha - beta - iter -
public void gibbsAtmHeap(AtmMarkovState s,
ExtLdaConfiguration c)
s - [in/out] statec - [in] configurationpublic void saveState(java.lang.String file)
saveState in class LdaGibbsSamplerfile - protected void sampleCorpus(AtmMarkovState s)
s -
protected int[] sampleAtmFullConditional(AtmMarkovState s,
int m,
int n)
s - statem - documentn - word
public static void main(java.lang.String[] args)
public AtmMarkovState getState()
getState in class LdaGibbsSampler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||