Skip to content
Snippets Groups Projects
Commit 807ca422 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Remove divide by zero for later ignored value.

Prevents an "invalid value" warning.
parent 33ac375d
Branches
Tags
2 merge requests!42GMM implementation in Python,!40Transition to a pure python implementation
...@@ -862,10 +862,20 @@ def map_gmm_m_step( ...@@ -862,10 +862,20 @@ def map_gmm_m_step(
# Equation 12 of Reynolds et al., "Speaker Verification Using Adapted # Equation 12 of Reynolds et al., "Speaker Verification Using Adapted
# Gaussian Mixture Models", Digital Signal Processing, 2000 # Gaussian Mixture Models", Digital Signal Processing, 2000
if update_means: if update_means:
# Apply threshold to prevent divide by zero below
n_threshold = np.where(
statistics.n < mean_var_update_threshold,
mean_var_update_threshold,
statistics.n,
)
# n_threshold = np.full(statistics.n.shape, fill_value=mean_var_update_threshold)
# n_threshold[statistics.n > mean_var_update_threshold] = statistics.n[
# statistics.n > mean_var_update_threshold
# ]
new_means = ( new_means = (
np.multiply( np.multiply(
alpha[:, None], alpha[:, None],
(statistics.sum_px / statistics.n[:, None]), (statistics.sum_px / n_threshold[:, None]),
) )
+ np.multiply((1 - alpha[:, None]), machine.ubm.means) + np.multiply((1 - alpha[:, None]), machine.ubm.means)
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment