All problems
Dirichlet Mean Vector
Problem
For a Dirichlet distribution with concentration vector alphas, return the mean vector with entries alphas[i] / sum(alphas). Return an empty list for an empty vector or any nonpositive concentration.
Hint
Each marginal is a Beta whose mean is the share of total concentration.
Test cases
case 1
in: [[1,1]]
expected: [0.5,0.5]
case 2
in: [[2,3,5]]
expected: [0.2,0.3,0.5]
case 3
in: [[1,1,1,1]]
expected: [0.25,0.25,0.25,0.25]
case 4
in: [[0,1]]
expected: []
case 5
in: [[]]
expected: []
Starter codePython
def dirichlet_mean_vector(alphas):
# Your code here
pass5 test cases · run your code against them in the editor