(train, test, cache=None)
return train_w, test_w
Use train set statistics to apply the ZCA whitening transform to
        both train and test sets.
Use train set statistics to apply the ZCA whitening transform to
        both train and test sets.
Use train set statistics to apply the ZCA whitening transform to both train and test sets .
def zca_whiten(train, test, cache=None):
        """
        Use train set statistics to apply the ZCA whitening transform to
        both train and test sets.
        """
        if cache and os.path.isfile(cache):
            with open(cache, 'rb') as f:
                (meanX, W) = pickle_load(f)
        else:
            meanX, W = CIFAR10._compute_zca_transform(train)
            if cache:
                logger.info("Caching ZCA transform matrix")
                with open(cache, 'wb') as f:
                    pickle.dump((meanX, W), f, 2)

        logger.info("Applying ZCA whitening transform")
        train_w = np.dot(train - meanX, W)
        test_w = np.dot(test - meanX, W)

        return train_w, test_w
def zca_whiten ( train , test , cache = None ) : if cache and os . path . isfile ( cache ) : with open ( cache , 'rb' ) as f : ( meanX , W ) = pickle_load ( f ) else : meanX , W = CIFAR10 . _compute_zca_transform ( train ) if cache : logger . info ( "Caching ZCA transform matrix" ) with open ( cache , 'wb' ) as f : pickle . dump ( ( meanX , W ) , f , 2 ) logger . info ( "Applying ZCA whitening transform" ) train_w = np . dot ( train - meanX , W ) test_w = np . dot ( test - meanX , W ) return train_w , test_w