Skip to content

Commit

Permalink
fix: keep finding small bugs in refine test
Browse files Browse the repository at this point in the history
  • Loading branch information
Radascript committed Jun 2, 2022
1 parent 70b921c commit 34b98fc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/test_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def test_refinement(random_seed=42):
cv_prev = np.random.ranf()
cv_curr = cv_prev * 0.9

# Get output of refine function
w_i_ref = emg.decomposition.refinement(
w_i, z, i=1, th_sil=0.9, filepath="", max_iter=10, random_seed=42
)
Expand Down Expand Up @@ -227,9 +228,12 @@ def test_refinement(random_seed=42):

# d. Updating vector via formula:
# w_i(n + 1) = (1/J) * [sum{for j=1 to j=J} z.(t_j)]
for step in range(J):
sum_js = z[:, step].sum()
w_i[step] = (1 / J) * sum_js
sum_cumul = np.zeros(z.shape[0])
for i in range(J):
peak_ind = peak_indices_a[i]
sum_cumul = sum_cumul + z[:, peak_ind]

w_i = sum_cumul * (1 / J)

# If silhouette score is greater than threshold, accept estimated source and add w_i to B
sil = emg.decomposition.silhouette_score(
Expand Down

0 comments on commit 34b98fc

Please sign in to comment.