(probs_N_K)
return np.array([np.random.choice(K, p=probs_N_K[i,:]) for i in xrange(N)])
Sample from N categorical distributions, each over K outcomes
Sample from N categorical distributions, each over K outcomes
Sample from N categorical distributions each over K outcomes
def sample_cats(probs_N_K):
    '''Sample from N categorical distributions, each over K outcomes'''
    N, K = probs_N_K.shape
    return np.array([np.random.choice(K, p=probs_N_K[i,:]) for i in xrange(N)])
def sample_cats ( probs_N_K ) : N , K = probs_N_K . shape return np . array ( [ np . random . choice ( K , p = probs_N_K [ i , : ] ) for i in xrange ( N ) ] )