vak.prep.frame_classification.make_splits.argsort_by_label_freq#

vak.prep.frame_classification.make_splits.argsort_by_label_freq(annots: list[Annotation]) list[int][source]#
Returns indices to sort a list of annotations

in order of more frequently appearing labels, i.e., the first annotation will have the label that appears least frequently and the last annotation will have the label that appears most frequently.

Used to sort a dataframe representing a dataset of annotated audio or spectrograms before cropping that dataset to a specified duration, so that it’s less likely that cropping will remove all occurrences of any label class from the total dataset.

annots: list

List of crowsetta.Annotation instances.

sort_inds: list

Integer values to sort annots.