def _reduce_data(self):
        """Private method to reduce data dimension.

        If data is dense, uses randomized PCA. If data is sparse, uses
        randomized SVD.
        TODO: should we subtract and store the mean?

        Returns
        -------
        Reduced data matrix
        """
        if self.n_pca is not None and self.n_pca < self.data.shape[1]:
            tasklogger.log_start("PCA")
            if sparse.issparse(self.data):
                if isinstance(self.data, sparse.coo_matrix) or \
                        isinstance(self.data, sparse.lil_matrix) or \
                        isinstance(self.data, sparse.dok_matrix):
                    self.data = self.data.tocsr()
                self.data_pca = TruncatedSVD(self.n_pca,
                                             random_state=self.random_state)
            else:
                self.data_pca = PCA(self.n_pca,
                                    svd_solver='randomized',
                                    random_state=self.random_state)
            self.data_pca.fit(self.data)
            data_nu = self.data_pca.transform(self.data)
            tasklogger.log_complete("PCA")
            return data_nu
        else:
            data_nu = self.data
            if sparse.issparse(data_nu) and not isinstance(
                    data_nu, (sparse.csr_matrix,
                              sparse.csc_matrix,
                              sparse.bsr_matrix)):
                data_nu = data_nu.tocsr()
            return data_nu
Private method to reduce data dimension.

        If data is dense, uses randomized PCA. If data is sparse, uses
        randomized SVD.
        TODO: should we subtract and store the mean?

        Returns
        -------
        Reduced data matrix