Approximate comparison of two event lists (with duration)

I have a black box algorithm that analyzes the time series and "detects" certain events in a series. It returns a list of events, each of which contains a start and end time. Events do not overlap. I also have a list of “true” events, again with start and end times for each event, not overlapping.

I want to compare two lists and compare detected and true events that fall within a certain time tolerance (True Positives). The complication is that the algorithm can detect events that do not actually exist (False Positives) or can skip events that were there (False Negatives).

What is an algorithm that optimally binds events from two lists and leaves the correct events unpaired? I am sure that I am not the first to solve this problem and that such a method exists, but I could not find it, perhaps because I do not know the correct terminology.

Speed ​​requirement: Lists will contain no more than a few hundred entries, and speed is not the main factor. Accuracy is more important. Anything that takes less than a few seconds on a regular computer will be fine.

+4
source share
1 answer

, . A1 <... < Am - , B1 <... < Bn - . sub (i, j) - , Ai Bj. del (i) - Ai. ins (j) - , Bj . ! sub, del ins, < ' j < j ',

sub(i, j') + sub(i', j) <= max {sub(i, j )       + sub(i', j')
                               ,del(i) + ins(j') + sub(i', j )
                               ,sub(i, j')       + del(i') + ins(j)
                               }.

, , , Levenshtein - .

​​ memoized , score(i, j), A1,..., Ai B1,..., Bj. score(m, n). , sub(i, j) .

score(i, j) | i == 0 && j == 0 =      0
            | i >  0 && j == 0 =      del(i)    + score(i - 1, 0    )
            | i == 0 && j >  0 =      ins(j)    + score(0    , j - 1)
            | i >  0 && j >  0 = max {sub(i, j) + score(i - 1, j - 1)
                                     ,del(i)    + score(i - 1, j    )
                                     ,ins(j)    + score(i    , j - 1)
                                     }

sub, del ins. , ; , 2. Ai = [s, t] Bj = [u, v],

sub(i, j) = -(|u - s|^2 + |v - t|^2)
del(i) = -(t - s)^2
ins(j) = -(v - u)^2.

( , , , , .)

+2

Source: https://habr.com/ru/post/1530037/


All Articles