def glr(arr1, arr2):
"""Generalized Likelihood Ratio"""
N1 = arr1.shape[0]
N2 = arr2.shape[0]
S1 = np.cov(arr1, rowvar=0)
S2 = np.cov(arr2, rowvar=0)
N = float(N1 + N2)
# This is COV only version, not optimized (revise) but more robust
# to environment noise conditions.
# See Ulpu thesis pages 30-31, also Gish et al. "Segregation of
# Speakers for Speech Recognition and Speaker Identification"
d = -(N / 2.0) * ((N1 / N) * np.log(det(S1)) + (N2 / N) * np.log(det(S2))
- np.log(det((N1 / N) * S1 + (N2 / N) * S2)))
# Ulpu version:
# Includes the mean, theoretically less robust
# arr = features[start:start+2*winsize]
# S = cov(arr, rowvar=0)
# d = -0.5*(N1*log(det(S1))+N2*log(det(S2))-N*log(det(S)))
return d
spk-clustering.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录