Create the mapping from label to numeric label

def get_label_mapping(train_labels):
    """
    Create the mapping from label to numeric label
    """
    sorted_labels = np.sort(np.unique(train_labels))
    label_mapping = {}
    for i, label in enumerate(sorted_labels):
        label_mapping[label] = i
    logging.info('Label mapping:%s', format(label_mapping))
    return label_mapping