def _do_scale_test(scaled):
 row_sum = scaled.sum(axis=1)
 col_sum = scaled.sum(axis=0)
 if issparse(scaled):
  row_sum = np.asarray(row_sum).squeeze()
  col_sum = np.asarray(col_sum).squeeze()
 assert_array_almost_equal(row_sum, np.tile(row_sum.mean(), 100), decimal=1)
 assert_array_almost_equal(col_sum, np.tile(col_sum.mean(), 100), decimal=1)

def _do_scale_test ( scaled ) : row_sum = scaled . sum ( axis = 1 ) col_sum = scaled . sum ( axis = 0 ) if issparse ( scaled ) : row_sum = np . asarray ( row_sum ) . squeeze ( ) col_sum = np . asarray ( col_sum ) . squeeze ( ) assert_array_almost_equal ( row_sum , np . tile ( row_sum . mean ( ) , 100 ) , decimal = 1 ) assert_array_almost_equal ( col_sum , np . tile ( col_sum . mean ( ) , 100 ) , decimal = 1 )
check that rows sum to one constant .