Description Usage Arguments Details Value Examples
View source: R/annotation_overlap.R
calculate overlap between two binary annotation sets
1 2 | annotation_overlap(x1, x2, seg_length = NULL, overlap_res = 100,
return_raw = FALSE)
|
x1 |
data.frame or matrix with annotations, needs columns named |
x2 |
data.frame or matrix with annotations, needs columns named |
seg_length |
numeric, total duration of the data (default is |
overlap_res |
numeric, resolution for overlap (default is |
return_raw |
logical, by default |
The function works like this. The total duration is segmented into overlap_res
segments. The midpoints of these segments serve as test values. For example, if the resolution is 100 and the duration is 60 seconds, we will obtain 100 segments of 0.6 seconds each. The test values lay in the center of each segment, i.e. at 0.3, 0.9, 1.2 etc. Now, for each of these test values, check in x1
and x2
whether an annotation exists.
Also, this function is more of a 'helper' function, that primarily is used inside the evaluate_sad
function.
a numeric value of overlap proportion, or a 0/1 vector.
1 2 3 4 5 6 7 8 9 10 11 12 | x1 <- data.frame(start = c(1, 4, 7), end = c(2.3, 4.2, 8))
x2 <- data.frame(start = c(0, 5), end = c(4, 6))
annotation_overlap(x1, x2)
annotation_overlap(x1, x2, seg_length = 60)
# one annotation set is empty
x3 <- x2[0, ]
annotation_overlap(x1, x3)
# with 'real' data
x1 <- read_rttm(system.file("noisemesSAD_synthetic_speech.rttm", package = "avutils"))
x2 <- read_elan(system.file("synthetic_speech.eaf", package = "avutils"))
annotation_overlap(x1, x2, overlap_res = 10)
annotation_overlap(x1, x2, overlap_res = 10, return_raw = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.