Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
nauman-daw committed Mar 29, 2021
1 parent 06b944c commit 5ce3729
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions speechbrain/processing/diarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,14 +1145,16 @@ def do_AHC(diary_obj, out_rttm_file, rec_id, k_oracle=4, p_val=0.3):

from sklearn.cluster import AgglomerativeClustering

# p_val --> threshold_val (for AHC)

if k_oracle is not None:
print("ORACLE SPKRs")
print("ORACLE SPKRs...")
num_of_spk = k_oracle
clustering = AgglomerativeClustering(
n_clusters=num_of_spk, affinity="cosine", linkage="ward"
).fit(diary_obj.stat1)
labels = clustering.labels_
print("labels.shape (Ora.) = ", labels.shape)
print("labels.shape (Oracle) = ", labels.shape)
else:
print("Using AHC threshold pval = ", p_val)
# Estimate num of using max eigen gap with `cos` affinity matrix.
Expand All @@ -1164,7 +1166,7 @@ def do_AHC(diary_obj, out_rttm_file, rec_id, k_oracle=4, p_val=0.3):
distance_threshold=p_val,
).fit(diary_obj.stat1)
labels = clustering.labels_
print("labels.shape (Est.) = ", labels.shape)
print("labels.shape (Estima) = ", labels.shape)

# Convert labels to speaker boundaries
subseg_ids = diary_obj.segset
Expand Down

0 comments on commit 5ce3729

Please sign in to comment.