#NEWLINE# def _compute_centers( self , X , sparse , rs ) : #NEWLINE# #INDENT# 'Generate RBF centers' #NEWLINE# centers = self . _get_user_components ( 'centers' ) #NEWLINE# if ( centers is None ) : #NEWLINE# #INDENT# n_features = X . shape [ 1 ] #NEWLINE# if sparse : #NEWLINE# #INDENT# fxr = xrange ( n_features ) #NEWLINE# cols = [ X . getcol ( i ) for i in fxr ] #NEWLINE# min_dtype = X . dtype . type ( 10000000000.0 ) #NEWLINE# sp_min = ( lambda col : np . minimum ( min_dtype , np . min ( col . data ) ) ) #NEWLINE# min_Xs = np . array ( map ( sp_min , cols ) ) #NEWLINE# max_dtype = X . dtype . type ( ( - 10000000000.0 ) ) #NEWLINE# sp_max = ( lambda col : np . maximum ( max_dtype , np . max ( col . data ) ) ) #NEWLINE# max_Xs = np . array ( map ( sp_max , cols ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# min_Xs = X . min ( axis = 0 ) #NEWLINE# max_Xs = X . max ( axis = 0 ) #NEWLINE# #UNINDENT# spans = ( max_Xs - min_Xs ) #NEWLINE# ctrs_size = ( self . n_hidden , n_features ) #NEWLINE# centers = ( min_Xs + ( spans * rs . uniform ( 0.0 , 1.0 , ctrs_size ) ) ) #NEWLINE# #UNINDENT# self . components_ [ 'centers' ] = centers