Skip to content

Commit

Permalink
fix: Add reg factor to whiten but leave commented out
Browse files Browse the repository at this point in the history
  • Loading branch information
danfke committed May 16, 2022
1 parent 53cf2f1 commit 7491d10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/emgdecompy/emgdecompy.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,11 @@ def whiten(x):
# Eigenvalues and eigenvectors
w, v = linalg.eig(cov_mat)

# Apply regularization factor, which is the average of smallest half of the eigenvalues (still not sure)
# w += w[:len(w) / 2].mean()

# Diagonal matrix inverse square root of eigenvalues
diagw = np.diag(1 / (w ** 0.5)) # or np.diag(1/((w+.1e-5)**0.5))
diagw = np.diag(1 / (w ** 0.5))
diagw = diagw.real.round(4)

# Whitening using zero component analysis: v diagw v.T x_cent
Expand Down

0 comments on commit 7491d10

Please sign in to comment.