#NEWLINE# def _fit( self , X ) : #NEWLINE# #INDENT# ( normalized_data , row_diag , col_diag ) = _scale_normalize ( X ) #NEWLINE# n_sv = ( 1 + int ( np . ceil ( np . log2 ( self . n_clusters ) ) ) ) #NEWLINE# ( u , v ) = self . _svd ( normalized_data , n_sv , n_discard = 1 ) #NEWLINE# z = np . vstack ( ( ( row_diag [ : , np . newaxis ] * u ) , ( col_diag [ : , np . newaxis ] * v ) ) ) #NEWLINE# ( _ , labels ) = self . _k_means ( z , self . n_clusters ) #NEWLINE# n_rows = X . shape [ 0 ] #NEWLINE# self . row_labels_ = labels [ : n_rows ] #NEWLINE# self . column_labels_ = labels [ n_rows : ] #NEWLINE# self . rows_ = np . vstack ( ( ( self . row_labels_ == c ) for c in range ( self . n_clusters ) ) ) #NEWLINE# self . columns_ = np . vstack ( ( ( self . column_labels_ == c ) for c in range ( self . n_clusters ) ) )