def _cov_eigen(self, X):
        n, d = X.shape

        cov = numpy.zeros((d, d))
        batch_size = self.minibatch_size

        for i in xrange(0, n, batch_size):
            logger.info('\tprocessing example {0}'.format(i))
            end = min(n, i + batch_size)
            x = X[i:end, :].todense() - self.mean_
            assert x.shape[0] == end - i

            prod = numpy.dot(x.T, x)
            assert prod.shape == (d, d)

            cov += prod

        cov /= n

        logger.info('computing eigens')
        v, W = linalg.eigh(cov, eigvals=(d - self.num_components, d - 1))

        # The resulting components are in *ascending* order of eigenvalue, and
        # W contains eigenvectors in its *columns*, so we simply reverse both.
        v, W = v[::-1], W[:, ::-1]
        return v, W
Display a package with all dependencies.
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/models/pca.py/SparseMatPCA._cov_eigen--crossover with--dataset/ETHPy150Open google/fplutil/disttools/push_package.py/display_package