I am using Gaussian mixture model for speaker identification. I use this code to predict the speaker for each voice clip.
for path in file_paths:
path = path.strip()
print (path)
sr,audio = read(source + path)
vector = extract_features(audio,sr)
#print(vector)
log_likelihood = np.zeros(len(models))
#print(len(log_likelihood))
for i in range(len(models)):
gmm1 = models[i] #checking with each model one by one
#print(gmm1)
scores = np.array(gmm1.score(vector))
#print(scores)
#print(len(scores))
log_likelihood[i] = scores.sum()
print(log_likelihood)
winner = np.argmax(log_likelihood)
#print(winner)
print ("\tdetected as - ", speakers[winner])
and it gives me the output like this:
[ 311.79769716 0. 0. 0. 0. ]
[ 311.79769716 -5692.56559902 0. 0. 0. ]
[ 311.79769716 -5692.56559902 -6170.21460788 0. 0. ]
[ 311.79769716 -5692.56559902 -6170.21460788 -6736.73192695 0. ]
[ 311.79769716 -5692.56559902 -6170.21460788 -6736.73192695 -6753.00196447]
detected as - bart
Here score function gives me the log probability for each speaker. Now i want to decide threshold value, for that i need these log probability value into simple probability value (between 0 to 1). How can i do that? I am using python software.
Thanks in advanced.