gluonts.nursery.anomaly_detection.supervised_metrics.utils module¶

gluonts.nursery.anomaly_detection.supervised_metrics.utils.labels_to_ranges(labels: List[bool]) → List[range][source]

Converts the given list of labels to list of anomaly (defined by positive label) ranges.

Parameters

labels – Boolean list of labels.

Returns

Return type

List of ranges.

gluonts.nursery.anomaly_detection.supervised_metrics.utils.labels_to_ranges_numba[source]

Converts the given list of labels to list of anomaly (defined by positive label) ranges where range is represented by a pair of integers (to make numba work).

Parameters

labels – Boolean list of labels.

Returns

Return type

List of ranges.

gluonts.nursery.anomaly_detection.supervised_metrics.utils.range_overlap(left_range: range, right_range: range) → bool[source]

Checks if two ranges have an overlap. Here each range is assumed to be consecutive, i.e., step field of range is always 1.

Parameters
• left_range

• right_range

Returns

Return type

True or False depending on the overlap.

gluonts.nursery.anomaly_detection.supervised_metrics.utils.ranges_to_singletons(ranges: List[range]) → List[range][source]

Convenient function to convert list of consecutive ranges to list of singleton ranges.

Parameters

ranges – List of ranges.

Returns

Return type

List of singleton ranges.