|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.knowceans.sandbox.hlda.ChineseRestaurantProcess
public class ChineseRestaurantProcess
CrpNode models a nested Chinese restaurant process (CRP)
Nested Class Summary | |
---|---|
(package private) class |
ChineseRestaurantProcess.CrpNode
|
Field Summary | |
---|---|
private int |
datasize
total occupation number |
private double |
gamma
concentration parameter of the CRP |
private java.util.Vector<ChineseRestaurantProcess.CrpNode> |
nodes
list of occupied tables in the CRP |
Constructor Summary | |
---|---|
ChineseRestaurantProcess(double gamma)
initialise CRP. |
Method Summary | ||
---|---|---|
static void |
main(java.lang.String[] args)
|
|
static
|
print(java.util.Collection<T> a)
|
|
static
|
print(T[] a)
|
|
private int |
sampleCrp()
sample a cluster according to the CRP scheme:
CRP example:
index : [0] [1] [2]
draw 1: 1 0 0 e.g., -> [0]
draw 2: 1/(1+gamma) gamma/(1+gamma) 0 -> [1]
draw 3: 1/(2+gamma) 1/(2+gamma) gamma/(2+gamma) -> [0]
draw 4: 2/(3+gamma) 1/(3+gamma) gamma/(3+gamma) -> [1]
i.e., the probability of drawing [2] becomes lower with every draw,
leading to an aggregated probability of cluster number that is
p(clusters) ~ log(datasize). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Vector<ChineseRestaurantProcess.CrpNode> nodes
private double gamma
private int datasize
Constructor Detail |
---|
public ChineseRestaurantProcess(double gamma)
gamma
- concentration parameter of the underlying CRP (p=1/nodes if
gamma is equal to the mean occupation number per child node). A
new cluster is introduced in distances of log(data) items.Method Detail |
---|
public static void main(java.lang.String[] args)
private int sampleCrp()
CRP example:
index : [0] [1] [2]
draw 1: 1 0 0 e.g., -> [0]
draw 2: 1/(1+gamma) gamma/(1+gamma) 0 -> [1]
draw 3: 1/(2+gamma) 1/(2+gamma) gamma/(2+gamma) -> [0]
draw 4: 2/(3+gamma) 1/(3+gamma) gamma/(3+gamma) -> [1]
i.e., the probability of drawing [2] becomes lower with every draw,
leading to an aggregated probability of cluster number that is
p(clusters) ~ log(datasize).
public static <T> void print(T[] a)
a
- public static <T> void print(java.util.Collection<T> a)
a
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |