Skip to main content
. 2012 Sep 27;12(10):13185–13211. doi: 10.3390/s121013185

Algorithm 1: Non-parametric Bayesian clustering algorithm for human motion recognition using collapsed Gibbs sampler

Input: O⃗(o⃗i, D), Sweeps, Γ(a, b), H⃗
Output: K, ci
1 begin
2 C⃗←c1, c2, …,c
3 K+0;
4 foreach s in Sweeps do
5   CsCs−1
6   foreach s in Sweeps do
7     mij=1(cj==ci)1;
8    if mi == 0 then
9     cjcj-1; ∀j ≻ i
10     K+K+ -1
11    end
12    dim ← length(μD)
13    foreach i in K do
14     covariances(i,dim)← iWishart(λ, v)
15     means← MVrnd(μ, covariances(i,dim))
16      mk=i=1RI(ci=k)
17     ci ← MVrnd(means,covariances)
18    end
19    /* Estimate the prior P(o⃗i|O⃗ H⃗) using Equation (31) */
20    if ciK+ then
21     K+K++1
22    end
23    /* Estimate the prior P(ci = k|C⃗−i, α) using Equations (23) and (24) */
24   end
25 end
26  /* Collapsed Gibbs Sampling */
27  /* Estimate the posterior P(ci = k|O⃗, C⃗−i, α; H⃗) using Equation (37) */
28
29 end