#NEWLINE# def transform( self , X , y = None ) : #NEWLINE# #INDENT# 'Project the data by using matrix product with the random matrix\n\n        Parameters\n        ----------\n        X : numpy array or scipy.sparse of shape [n_samples, n_features]\n            The input data to project into a smaller dimensional space.\n\n        y : is not used: placeholder to allow for usage in a Pipeline.\n\n        Returns\n        -------\n        X_new : numpy array or scipy sparse of shape [n_samples, n_components]\n            Projected array.\n\n        ' #NEWLINE# X = check_array ( X , accept_sparse = [ 'csr' , 'csc' ] ) #NEWLINE# if ( self . components_ is None ) : #NEWLINE# #INDENT# raise NotFittedError ( 'No random projection matrix had been fit.' ) #NEWLINE# #UNINDENT# if ( X . shape [ 1 ] != self . components_ . shape [ 1 ] ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Impossible to perform projection:X at fit stage had a different number of features. (%s != %s)' % ( X . shape [ 1 ] , self . components_ . shape [ 1 ] ) ) ) #NEWLINE# #UNINDENT# X_new = safe_sparse_dot ( X , self . components_ . T , dense_output = self . dense_output ) #NEWLINE# return X_new