def getGradientForMultinomials(alphas, ss, delta):
    K = len(alphas)
    C = digamma(sum(alphas))
    retVal = ([C] * K)
    for k in range(0, K):
        retVal[k] += ((ss[k] - digamma(alphas[k])) - ((2 * delta) * alphas[k]))
    return retVal
def getGradientForMultinomials(alphas, ss, delta):
    K = len(alphas)
    C = digamma(sum(alphas))
    retVal = ([C] * K)
    for k in range(0, K):
        retVal[k] += ((ss[k] - digamma(alphas[k])) - ((2 * delta) * alphas[k]))
    return retVal