#NEWLINE# def _rescale_data( X , y , sample_weight ) : #NEWLINE# #INDENT# 'Rescale data so as to support sample_weight' #NEWLINE# n_samples = X . shape [ 0 ] #NEWLINE# sample_weight = ( sample_weight * np . ones ( n_samples ) ) #NEWLINE# sample_weight = np . sqrt ( sample_weight ) #NEWLINE# sw_matrix = sparse . dia_matrix ( ( sample_weight , 0 ) , shape = ( n_samples , n_samples ) ) #NEWLINE# X = safe_sparse_dot ( n_samples , X ) #NEWLINE# y = safe_sparse_dot ( sw_matrix , y ) #NEWLINE# return ( X , y )