org.knowceans.topics.cgen
Class Hpam1iGibbsSampler
java.lang.Object
org.knowceans.topics.cgen.Hpam1iGibbsSampler
public class Hpam1iGibbsSampler
- extends java.lang.Object
Generated Gibbs sampler for the HPAM1 model. Hierarchical PAM model (HPAM1),
testing C1B and C2 structures as well as custom selectors. Model with fully
dependent samplers.
Implementation using 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] >> (zeta[x,y] | gamma) >> l[m][n]
x[m][n], y[m][n], l[m][n] >> (phi[k] | beta) >> w[m][n]
k: {
if (l==0) k = 0;
else if (l==1) k = 1 + x;
else if (l==2) 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|E3COUPLED}
parents: thetax
children: zeta phi
range: Y
----
hiertop-word (phi[k] | beta)
type: {TOPIC|C2MULTI}
parents: x y l
children: w
components: phi, domain: 1 + X + Y, range: V
counts: nkw, sum: nkwsum
index: k, selector:
if (l==0) k = 0;
else if (l==1) k = 1 + x;
else if (l==2) k = 1 + X + y;
hyperparams: beta, dimension 1, fixed: false
----
word w[m][n]
type: {VISIBLE|E1SINGLE}
parents: phi
children: (leaf)
range: V
----
toptop-level (zeta[x,y] | gamma)
type: {TOPIC|C2MULTI}
parents: x y
children: l
components: zeta, domain: X * Y, range: L
counts: nxyl, sum: nxylsum
index: xy, selector: x,y
hyperparams: gamma, dimension 1, fixed: false
----
level l[m][n]
type: {HIDDEN|QFIXED|E1SINGLE}
parents: zeta
children: phi
range: L
----
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 zeta phi
range: X
----
sequences:
words [m][n]
parent: (root), children: []
edges: m x y l 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) double |
gamma
|
(package private) double |
gammasum
|
(package private) int |
iter
|
(package private) int[][] |
l
|
(package private) int |
L
|
(package private) int[][] |
lq
|
(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) int[][] |
nxyl
|
(package private) int[] |
nxylsum
|
(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
|
(package private) double[][] |
zeta
|
Constructor Summary |
Hpam1iGibbsSampler(double alphax,
int Y,
double beta,
int[][] w,
int[][] wq,
int V,
double gamma,
double alpha,
int X,
java.util.Random rand)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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
nxyl
int[][] nxyl
nxylsum
int[] nxylsum
gamma
double gamma
gammasum
double gammasum
zeta
double[][] zeta
l
int[][] l
lq
int[][] lq
L
int L
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
Hpam1iGibbsSampler
public Hpam1iGibbsSampler(double alphax,
int Y,
double beta,
int[][] w,
int[][] wq,
int V,
double gamma,
double alpha,
int X,
java.util.Random rand)
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