'Compute the zca whitening transform matrix.'

@staticmethod
def _compute_zca_transform(imgs, filter_bias=0.1):

    logger.info('Computing    ZCA    transform    matrix')
    meanX = np.mean(imgs, 0)
    covX = np.cov(imgs.T)
    (D, E) = np.linalg.eigh((covX + (filter_bias * np.eye(covX.shape[0], covX.shape[1]))))
    assert (not np.isnan(D).any())
    assert (not np.isnan(E).any())
    assert (D.min() > 0)
    D = (D ** (-0.5))
    W = np.dot(E, np.dot(np.diag(D), E.T))
    return (meanX, W)
