def bic(arr1, arr2):
"""Bayes Information Criterion."""
# Notes: In the seminal paper "Speakers, environment and channel
# change detection and clustering via the Bayesian Information
# Criterion" by Chen and Gopalakrishnan, they use a growing window
# approach, so it's not directly comparable when using a fixed
# sliding window.
arr = np.concatenate((arr1, arr2))
N1 = arr1.shape[0]
N2 = arr2.shape[0]
S1 = np.cov(arr1, rowvar=0)
S2 = np.cov(arr2, rowvar=0)
N = arr.shape[0]
S = np.cov(arr, rowvar=0)
d = 0.5 * N * np.log(det(S)) - 0.5 * N1 * np.log(det(S1))\
- 0.5 * N2 * np.log(det(S2))
p = arr.shape[1]
corr = args.lambdac * 0.5 * (p + 0.5 * p * (p + 1)) * np.log(N)
d -= corr
return d
spk-clustering.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录