def getClasses(labels):
"""
Get unique values from a column of labels.
Parameters
----------
labels: array-like of shape = [number_samples] or [number_samples, number_outputs]
The target values (class labels in classification).
Return
----------
classes: ndarray
The sorted unique labels
ids: ndarray
The indices of the first occurrences of the unique values in the original array.
"""
uniques, ids = numpy.unique(labels, return_inverse=True)
return uniques, ids
评论列表
文章目录