Skip to main content
. 2017 Aug 23;17(9):1932. doi: 10.3390/s17091932
Algorithm 3. KLD sampling algorithm
Input: st1={xt1(i),wt1(i)|i=1,,n} , observations zt , limits ε  and δ;
Output: St
1: St,n=0,k=0,α=0    % initializing
2: do                % generating samples
3:  sampling from discrete distributions under the weight of known st1 , the sequence is j(n)
4:  sampling xt(n) from p(xt|xt1) using xt1(j(n))
5:  wt(n)p(zt|xt(n))       % calculate the importance weights
6:  α α+wt(n)          % update the normalization factor
7:  StSt{xt(n),wt(n)}    % insert the sample into the sample set
8:  if (xt(n) fall in bin b ) then    % update the number of bins
9:   kk+1
10:   bnonempty
11:  nn+1          % update the number of generated samples
12: while (n<12ϵXk1,1δ2)     % stop when come to the limits K-L with Equation (35)
13: for i: = 1, …, n do         % normalize importance weights
14:  wt(i)=wt(i)/α