def test_concentration():
 dense = np.random.randn(5, 10).astype('float32')
 sparse = np.random.randn(5, 10).astype('float32')
 sparse[:, 1:] /= 100000.0
 weights = Variable(dense)
 dhl_dense_10 = dirichlet_likelihood(weights, alpha=10.0).data
 dhl_dense_01 = dirichlet_likelihood(weights, alpha=0.1).data
 weights = Variable(sparse)
 dhl_sparse_10 = dirichlet_likelihood(weights, alpha=10.0).data
 dhl_sparse_01 = dirichlet_likelihood(weights, alpha=0.1).data
 msg = 'Sparse vector has higher likelihood than dense with alpha=0.1'
 assert (dhl_sparse_01 > dhl_dense_01), msg
 msg = 'Dense vector has higher likelihood than sparse with alpha=10.0'
 assert (dhl_dense_10 > dhl_sparse_10), msg

def test_concentration ( ) : dense = np . random . randn ( 5 , 10 ) . astype ( 'float32' ) sparse = np . random . randn ( 5 , 10 ) . astype ( 'float32' ) sparse [ : , 1 : ] /= 100000.0 weights = Variable ( dense ) dhl_dense_10 = dirichlet_likelihood ( weights , alpha = 10.0 ) . data dhl_dense_01 = dirichlet_likelihood ( weights , alpha = 0.1 ) . data weights = Variable ( sparse ) dhl_sparse_10 = dirichlet_likelihood ( weights , alpha = 10.0 ) . data dhl_sparse_01 = dirichlet_likelihood ( weights , alpha = 0.1 ) . data msg = 'Sparse vector has higher likelihood than dense with alpha=0.1' assert ( dhl_sparse_01 > dhl_dense_01 ) , msg msg = 'Dense vector has higher likelihood than sparse with alpha=10.0' assert ( dhl_dense_10 > dhl_sparse_10 ) , msg
test that alpha > 1 .