Hi, I find below code snippet on line:
////////// m = 10 theta_A = 0.8 theta_B = 0.3 theta_0 = [theta_A, theta_B] coin_A = bernoulli(theta_A) coin_B = bernoulli(theta_B) xs = map(sum, [coin_A.rvs(m), coin_A.rvs(m), coin_B.rvs(m), coin_A.rvs(m), coin_B.rvs(m)]) ///////// I see [coin_A.rvs(m), coin_A.rvs(m), coin_B.rvs(m), coin_A.rvs(m), coin_B.rvs(m)] is simply a list, but I don't know what use of 'sum' in this line. I replace the random number with a simple list: /////// yy=map(sum, [13, 22, 33, 41]) In [24]: yy Out[24]: [13, 22, 33, 41] /////// I don't see 'sum' has any effect above. The code source is from: #http://people.duke.edu/~ccc14/sta-663/EMAlgorithm.html What could you help me on the 'sum'? Thanks, -- https://mail.python.org/mailman/listinfo/python-list