Research Article

Estimating Network Flow Length Distributions via Bayesian Nonnegative Tensor Factorization

Algorithm 2

ANLS sampling algorithm.
(1)function Setup ANLSu
(2)f[0] = 0
(3)for do
(4)  
(5)  
(6)return f, p
(7)function SampleWithANLS (p, flow_table, packet)
(8) flow = flow_table·look-up (packet)
(9)if flow is null then
(10)  flow  new Flow (packet)
(11)else if p[flow·length]  rand_double (0, 1) then
(12)  flow·length+ = 1
(13) flow_table·insert_or_update (flow)