def bic(arr1, arr2, epsilon=1e-50):
"""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))
detS1 = det(np.cov(arr1, rowvar=0))
detS2 = det(np.cov(arr2, rowvar=0))
N1 = arr1.shape[0]
N2 = arr2.shape[0]
N = arr.shape[0]
detS = det(np.cov(arr, rowvar=0))
d = 0.5 * N * np.log(detS) - 0.5 * N1 * np.log(detS1)\
- 0.5 * N2 * np.log(detS2)
p = arr.shape[1]
corr = args.lambdac * 0.5 * (p + 0.5 * p * (p + 1)) * np.log(N)
d -= corr
return d
spk-clustering2.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录