【发布时间】:2021-11-20 03:00:17
【问题描述】:
问题:
We now calculate the synchronization between all possible pairs of rows
in the matrix. Given two lists A and B, each of N values 0 or 1, and a value tau
between zero and N, we define the synchronization index between A and B as:
0.5 * (c(B|A) + c(A|B))
Sync = -----------------------
sqrt(m(A)*m(B))
Where:
- c(B|A) is the number of times an accent of B is preceded by an accent of A
within a distance <= tau
- c(A|B) is the number of times an accent of A is preceded by an accent of B
within a distance <= tau
- m(A) is the number of accents in A
- m(B) is the number of accents in B
and where, remember, a value of 1 in A or B represents an accent
NOTA: if m(A) == 0 o m(B) == 0 then we assume zero Sync
For example, given the two sequences and value of tau:
- A = [0, 0, 0, 0, 1, 0, 0, 1]
- B = [1, 0, 1, 0, 1, 0, 0, 0]
- tau = 3
we will obtain:
- c(B|A) = 1, as only the third accent in B (position 4) is preceded in A by a
accent within 3 positions (in this case the 1 in A has the same position
as the 1 in B)
- c(A|B) = 2, as both accents of A are preceded in B by two accents within
3 positions
- m(A) = 2
- m(B) = 3
- Sync = 0.5 × (1 + 2) / sqrt(2×3) = 0.6123724356957946
[c(B|A) 和/或 c(A|B) 是如何计算的,请解释一下]
[重音为 1,因此第三个重音表示列表中的第三个“1”(因此 B 的第三个重音表示列表 B 中的第三个“1”,即位置 4(B[4]==第三个重音))
我试图了解它是如何计算的,但我很困惑
【问题讨论】:
标签: python logic calculation