#NEWLINE# def train( self , X ) : #NEWLINE# #INDENT# "\n        Compute the PCA transformation matrix.\n\n        Given a rectangular matrix :math:`X = USV` such that :math:`S` is a\n        diagonal matrix with :math:`X`'s singular values along its diagonal,\n        returns :math:`W = V^{-1}`.\n\n        If mean is provided, :math:`X` will not be centered first.\n\n        Parameters\n        ----------\n        X : numpy.ndarray\n            Matrix of shape (n, d) on which to train PCA\n        " #NEWLINE# assert sparse . issparse ( X ) #NEWLINE# logger . info ( 'computing mean' ) #NEWLINE# self . mean_ = numpy . asarray ( X . mean ( axis = 0 ) ) [ 0 , : ] #NEWLINE# super ( SparseMatPCA , self ) . train ( X , mean = self . mean_ )