|
Algorithm 3. KLD sampling algorithm |
|
Input:
, observations
, limits
and; |
|
Output:
|
| 1:
% initializing |
| 2: do % generating samples |
| 3: sampling from discrete distributions under the weight of known
, the sequence is
|
| 4: sampling
from
using
|
| 5: % calculate the importance weights |
| 6:
% update the normalization factor |
| 7: % insert the sample into the sample set |
| 8: if ( fall in ) then % update the number of
|
| 9:
|
| 10:
|
| 11: % update the number of generated samples |
| 12: while () % stop when come to the limits K-L with Equation (35) |
| 13: for
i: = 1, …, n
do % normalize importance weights |
| 14:
|