org.knowceans.topics.cgen
Class LdaGibbsSerB

java.lang.Object
  extended by org.knowceans.topics.cgen.LdaGibbsSerB
All Implemented Interfaces:
org.knowceans.topics.simple.ISimpleGibbs, org.knowceans.topics.simple.ISimplePpx, org.knowceans.topics.simple.ISimpleQueryGibbs

public class LdaGibbsSerB
extends java.lang.Object
implements org.knowceans.topics.simple.ISimpleGibbs, org.knowceans.topics.simple.ISimpleQueryGibbs, org.knowceans.topics.simple.ISimplePpx

LDA Gibbs sampler: (m,k | alpha), (k,t | beta)

Serial fast version with (2, 2, inf) norms, refactored from SerA

Author:
gregor

Constructor Summary
LdaGibbsSerB(int[][] w, int[][] wq, int K, int V, double alpha, double beta, java.util.Random rand)
          parametrise gibbs sampler
 
Method Summary
 void init()
          initialise Markov chain
 void initq()
          initialise Markov chain for querying
static void main(java.lang.String[] args)
          test driver for mixture network Gibbs sampler
 double ppx()
           
 void run(int niter)
          run Gibbs sampler
 void runq(int niter)
          query Gibbs sampler
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LdaGibbsSerB

public LdaGibbsSerB(int[][] w,
                    int[][] wq,
                    int K,
                    int V,
                    double alpha,
                    double beta,
                    java.util.Random rand)
parametrise gibbs sampler

Parameters:
w - word tokens
wq - word tokens (testing)
K - number of topics
V - number of terms
alpha - node A hyperparam
beta - node B hyperparam
rand - random number generator
Method Detail

main

public static void main(java.lang.String[] args)
test driver for mixture network Gibbs sampler

Parameters:
args -

init

public void init()
initialise Markov chain

Specified by:
init in interface org.knowceans.topics.simple.ISimpleGibbs

initq

public void initq()
initialise Markov chain for querying

Specified by:
initq in interface org.knowceans.topics.simple.ISimpleQueryGibbs

run

public void run(int niter)
run Gibbs sampler

Specified by:
run in interface org.knowceans.topics.simple.ISimpleGibbs
Parameters:
niter - number of Gibbs iterations

runq

public void runq(int niter)
query Gibbs sampler

Specified by:
runq in interface org.knowceans.topics.simple.ISimpleQueryGibbs
Parameters:
niter - number of Gibbs iterations

ppx

public double ppx()
Specified by:
ppx in interface org.knowceans.topics.simple.ISimplePpx
Returns:
the perplexity of the last query sample

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object