Skip to contents

Iterates through the given segments_copy data frame. Does the following at each iteration:

  1. Finds the largest segment (by size). Then, finds all the segments 'close' to it: closeness here means that that ratio_median difference between them is less than threshold (thr).

  2. Once we identify these segments that are 'close' to each other (called closest_indices), we iterate through them, and set their level in segments.

  3. Finally, remove these closest_indices segments from segments_copy.

Usage

AssignLevels(segments, thr)

Arguments

segments

A data frame containing segment data.

thr

A float: the threshold previously estimated via KDE. Used to determine whether large segments are merged.