

def log_likelihood(self, data):
    x = data['x']
    pi = self.pi(data)
    pi = np.clip(pi, 1e-16, (1 - 1e-16))
    assert (x.shape == pi.shape)
    ll = 0
    ll += (gammaln((x.sum(axis=1) + 1)).sum() - gammaln((x + 1)).sum())
    ll += (x * np.log(pi)).sum()
    return ll

dataset/ETHPy150Open HIPS/pgmult/pgmult/distributions.py PGMultinomialRegression.log_likelihood/original