def _make_grid_to_short_label(dataset):
 unique_values = [sorted(list(frozenset(column))) for column in dataset.y[:, :5].transpose()]
 category_index = dataset.label_name_to_index['category']
 unique_categories = unique_values[category_index]
 category_to_name = dataset.label_to_value_funcs[category_index]
 if any(((category_to_name(category) == 'blank') for category in unique_categories)):
  for d in range(1, len(unique_values)):
   assert (unique_values[d][0] == (-1)), ('unique_values: %s' % str(unique_values))
   unique_values[d] = unique_values[d][1:]
 return unique_values

def _make_grid_to_short_label ( dataset ) : unique_values = [ sorted ( list ( frozenset ( column ) ) ) for column in dataset . y [ : , : 5 ] . transpose ( ) ] category_index = dataset . label_name_to_index [ 'category' ] unique_categories = unique_values [ category_index ] category_to_name = dataset . label_to_value_funcs [ category_index ] if any ( ( ( category_to_name ( category ) == 'blank' ) for category in unique_categories ) ) : for d in range ( 1 , len ( unique_values ) ) : assert ( unique_values [ d ] [ 0 ] == ( - 1 ) ) , ( 'unique_values: %s' % str ( unique_values ) ) unique_values [ d ] = unique_values [ d ] [ 1 : ] return unique_values
returns an array x such that x[a][b] gives label index as bth unique value .