org.knowceans.topics.cgen
Class Hpam2GibbsSampler

java.lang.Object
  extended by org.knowceans.topics.cgen.Hpam2GibbsSampler

public class Hpam2GibbsSampler
extends java.lang.Object

Generated Gibbs sampler for the HPAM2 model. Hierarchical PAM model (HPAM2), testing C1B and C2 structures as well as custom selectors with switch. Model with fully dependent samplers. Mixture network specification:

 m >> (theta[m] | alpha) >> x[m][n]
 m, x[m][n] >> (thetax[m,x] | alphax[x]) >> y[m][n]
 x[m][n], y[m][n] >> (phi[k] | beta) >> w[m][n]
 
 k: { 
 // TODO: x==0 --> y = IDLE ?
 if (x==0) { k = 0; }
 else if (y==0) k = 1 + x;
 else k = 1 + X + y; 
 }. 
 
 elements:
 
    document m
    type: {ROOT|E3COUPLED}
    parents: (root)
    children: theta thetax
    range: M
 ----
    top-subtop (thetax[m,x] | alphax[x])
    type: {SEQUENCE|C1BSEQADD}
    parents: m x
    children: y
    components: thetax, domain: M *  X, range: Y
    counts: nmxy, sum: nmxysum
    index: mx, selector: m,x
    hyperparams: alphax, dimension: X * Y, selector: x, fixed: false 
 ----
    subtopic y[m][n]
    type: {HIDDEN|E1SINGLE}
    parents: thetax
    children: phi
    range: Y
 ----
    hiertop-word (phi[k] | beta)
    type: {TOPIC|C2MULTI}
    parents: x y
    children: w
    components: phi, domain: 1 + X + Y, range: V
    counts: nkw, sum: nkwsum
    index: k, selector: 
 // TODO: x==0 --> y = IDLE ?
 if (x==0) { k = 0; }
 else if (y==0) k = 1 + x;
 else k = 1 + X + y;
    hyperparams: beta, dimension 1, fixed: false 
 ----
    word w[m][n]
    type: {VISIBLE|E1SINGLE}
    parents: phi
    children: (leaf)
    range: V
 ----
    doc-suptop (theta[m] | alpha)
    type: {SEQUENCE|C1ROOT}
    parents: m
    children: x
    components: theta, domain: M, range: X
    counts: nmx, sum: null
    index: m, selector: null
    hyperparams: alpha, dimension X, fixed: false 
 ----
    suptopic x[m][n]
    type: {HIDDEN|E3COUPLED}
    parents: theta
    children: thetax phi
    range: X
 ----
 sequences:
 
 words [m][n]
 parent: (root), children: []
 edges: m x y w
 

Author:
gregor heinrich (via MixNetKernelGenerator)

Field Summary
(package private)  double[] alpha
           
(package private)  double alphasum
           
(package private)  double[][] alphax
           
(package private)  double[] alphaxsum
           
(package private)  double beta
           
(package private)  double betasum
           
(package private) static int IDLE
           
(package private)  int iter
           
(package private)  int M
           
(package private)  int Mq
           
(package private)  int niter
           
(package private)  int[][] nkw
           
(package private)  int[] nkwsum
           
(package private)  int[][] nmx
           
(package private)  int[][] nmxq
           
(package private)  int[][] nmxy
           
(package private)  int[][] nmxyq
           
(package private)  int[] nmxysum
           
(package private)  int[] nmxysumq
           
(package private)  double[][] phi
           
(package private)  double[][] pp
           
(package private)  java.util.Random rand
           
(package private)  int V
           
(package private)  int[][] w
           
(package private)  int W
           
(package private)  int[][] wq
           
(package private)  int Wq
           
(package private)  int[][] x
           
(package private)  int X
           
(package private)  int[][] xq
           
(package private)  int[][] y
           
(package private)  int Y
           
(package private)  int[][] yq
           
 
Constructor Summary
Hpam2GibbsSampler(double alphax, int Y, double beta, int[][] w, int[][] wq, int V, double alpha, int X, java.util.Random rand)
           
 
Method Summary
 void estAlpha()
           
 void init()
           
 void initq()
           
static void main(java.lang.String[] args)
           
 double ppx()
           
 void run(int niter)
           
 void runq(int niterq)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rand

java.util.Random rand

iter

int iter

niter

int niter

M

int M

Mq

int Mq

nmxy

int[][] nmxy

nmxyq

int[][] nmxyq

nmxysum

int[] nmxysum

nmxysumq

int[] nmxysumq

alphax

double[][] alphax

alphaxsum

double[] alphaxsum

y

int[][] y

yq

int[][] yq

Y

int Y

nkw

int[][] nkw

nkwsum

int[] nkwsum

beta

double beta

betasum

double betasum

phi

double[][] phi

w

int[][] w

wq

int[][] wq

V

int V

nmx

int[][] nmx

nmxq

int[][] nmxq

alpha

double[] alpha

alphasum

double alphasum

x

int[][] x

xq

int[][] xq

X

int X

W

int W

Wq

int Wq

pp

double[][] pp

IDLE

static final int IDLE
See Also:
Constant Field Values
Constructor Detail

Hpam2GibbsSampler

public Hpam2GibbsSampler(double alphax,
                         int Y,
                         double beta,
                         int[][] w,
                         int[][] wq,
                         int V,
                         double alpha,
                         int X,
                         java.util.Random rand)
Method Detail

main

public static void main(java.lang.String[] args)

init

public void init()

initq

public void initq()

run

public void run(int niter)

runq

public void runq(int niterq)

estAlpha

public void estAlpha()

ppx

public double ppx()

toString

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