(imgs, filter_bias=0.1)
return meanX, W
Compute the zca whitening transform matrix.
Compute the zca whitening transform matrix.
Compute the zca whitening transform matrix .
def _compute_zca_transform(imgs, filter_bias=0.1):
        """
        Compute the zca whitening transform matrix.
        """
        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 ** -.5

        W = np.dot(E, np.dot(np.diag(D), E.T))
        return meanX, W
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 ** - .5 W = np . dot ( E , np . dot ( np . diag ( D ) , E . T ) ) return meanX , W