def kullback_leibler(c1, c2):
    """Kullback Leibler divergence of two Gaussians, :math:`KL(1||2)`"""
    d = c2.log_det_sigma - c1.log_det_sigma
    d += np.trace(c2.inv_sigma.dot(c1.sigma))
    mean_diff = c1.mu - c2.mu
    d += mean_diff.transpose().dot(c2.inv_sigma).dot(mean_diff)
    d -= len(c1.mu)

    return 0.5 * d
def kullback_leibler ( c1 , c2 ) : d = c2 . log_det_sigma - c1 . log_det_sigma d += np . trace ( c2 . inv_sigma . dot ( c1 . sigma ) ) mean_diff = c1 . mu - c2 . mu d += mean_diff . transpose ( ) . dot ( c2 . inv_sigma ) . dot ( mean_diff ) d -= len ( c1 . mu ) return 0.5 * d
Kullback Leibler divergence of two Gaussians, :math:`KL(1||2)`