CompML / PRTS

Unofficial Python implementation of "Precision and Recall for Time Series".
https://papers.nips.cc/paper/2018/file/8f468c873a32bb0619eaeb2050ba45d1-Paper.pdf
Apache License 2.0
38 stars 4 forks source link

Implement the '_omega_function' function in the prts/interfaces/time_series_metrics.py #15

Closed nocotan closed 3 years ago

nocotan commented 3 years ago

Summary

Implement the common function _omega_function as follows:

    def _omega_function(self, rrange, overlap):
        anomaly_length = rrange[1] - rrange[0] + 1
        my_positional_bias = 0
        max_positional_bias = 0
        temp_bias = 0
        for i in range(1, anomaly_length + 1):
            temp_bias = self._delta_function(i, anomaly_length)
            max_positional_bias += temp_bias
            j = rrange[0] + i - 1
            if j >= overlap[0] and j <= overlap[1]:
                my_positional_bias += temp_bias
        if max_positional_bias > 0:
            res = my_positional_bias / max_positional_bias
            return res
        else:
            return 0

Goal

Make it enable us to compute the value of omega.

Todo

Deadline

yyyy / mm / dd

Parent issue

If the parent issue exists, post a link here.

References

If there are any reference links, they are described here.

Notes

Other comments.