Skip to content

Commit

Permalink
fix: fix intra_sums
Browse files Browse the repository at this point in the history
  • Loading branch information
danfke committed May 26, 2022
1 parent 9c8ebc7 commit be163f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/emgdecompy/decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def silhouette_score(s_i, kmeans, peak_indices_a, peak_indices_b, centroid_a):
centroid_b = abs(centroid_a - 1)

# Calculate within-cluster sums of point-to-centroid distances
intra_sums = abs(s_i[peak_indices_a] - kmeans.cluster_centers_[centroid_a]) + abs(s_i[peak_indices_b] - kmeans.cluster_centers_[centroid_b])
intra_sums = abs(s_i[peak_indices_a] - kmeans.cluster_centers_[centroid_a]).sum() + abs(s_i[peak_indices_b] - kmeans.cluster_centers_[centroid_b]).sum()

# Calculate between-cluster sums of point-to-centroid distances
inter_sums = abs(s_i[peak_indices_a] - kmeans.cluster_centers_[centroid_b]).sum() + abs(s_i[peak_indices_b] - kmeans.cluster_centers_[centroid_a]).sum()
Expand Down

0 comments on commit be163f1

Please sign in to comment.