@@ -738,23 +738,23 @@ class Spec_Clust_unorm:
738738 [0.904 0.982 0.928 1. 0.976]
739739 [0.966 0.997 0.972 0.976 1. ]]
740740 >>> # Prunning
741- >>> prunned_sim_mat = clust.p_pruning(sim_mat, 0.3)
742- >>> print (np.around(prunned_sim_mat [5:,5:], decimals=3))
741+ >>> pruned_sim_mat = clust.p_pruning(sim_mat, 0.3)
742+ >>> print (np.around(pruned_sim_mat [5:,5:], decimals=3))
743743 [[1. 0. 0. 0. 0. ]
744744 [0. 1. 0. 0.982 0.997]
745745 [0. 0.977 1. 0. 0.972]
746746 [0. 0.982 0. 1. 0.976]
747747 [0. 0.997 0. 0.976 1. ]]
748748 >>> # Symmetrization
749- >>> sym_prund_sim_mat = 0.5 * (prunned_sim_mat + prunned_sim_mat .T)
750- >>> print (np.around(sym_prund_sim_mat [5:,5:], decimals=3))
749+ >>> sym_pruned_sim_mat = 0.5 * (pruned_sim_mat + pruned_sim_mat .T)
750+ >>> print (np.around(sym_pruned_sim_mat [5:,5:], decimals=3))
751751 [[1. 0. 0. 0. 0. ]
752752 [0. 1. 0.489 0.982 0.997]
753753 [0. 0.489 1. 0. 0.486]
754754 [0. 0.982 0. 1. 0.976]
755755 [0. 0.997 0.486 0.976 1. ]]
756756 >>> # Laplacian
757- >>> laplacian = clust.get_laplacian(sym_prund_sim_mat )
757+ >>> laplacian = clust.get_laplacian(sym_pruned_sim_mat )
758758 >>> print (np.around(laplacian[5:,5:], decimals=3))
759759 [[ 1.999 0. 0. 0. 0. ]
760760 [ 0. 2.468 -0.489 -0.982 -0.997]
@@ -796,13 +796,13 @@ def do_spec_clust(self, X, k_oracle, p_val):
796796 sim_mat = self .get_sim_mat (X )
797797
798798 # Refining similarity matrix with p_val
799- prunned_sim_mat = self .p_pruning (sim_mat , p_val )
799+ pruned_sim_mat = self .p_pruning (sim_mat , p_val )
800800
801801 # Symmetrization
802- sym_prund_sim_mat = 0.5 * (prunned_sim_mat + prunned_sim_mat .T )
802+ sym_pruned_sim_mat = 0.5 * (pruned_sim_mat + pruned_sim_mat .T )
803803
804804 # Laplacian calculation
805- laplacian = self .get_laplacian (sym_prund_sim_mat )
805+ laplacian = self .get_laplacian (sym_pruned_sim_mat )
806806
807807 # Get Spectral Embeddings
808808 emb , num_of_spk = self .get_spec_embs (laplacian , k_oracle )
@@ -845,7 +845,7 @@ def p_pruning(self, A, pval):
845845 -------
846846 A : array
847847 (n_samples, n_samples).
848- Prunned affinity matrix based on p_val.
848+ pruned affinity matrix based on p_val.
849849 """
850850
851851 n_elems = int ((1 - pval ) * A .shape [0 ])
@@ -917,8 +917,9 @@ def get_spec_embs(self, L, k_oracle=4):
917917 : min (self .max_num_spkrs , len (lambda_gap_list ))
918918 ]
919919 )
920- + 2
921- )
920+ if lambda_gap_list
921+ else 0
922+ ) + 2
922923
923924 if num_of_spk < self .min_num_spkrs :
924925 num_of_spk = self .min_num_spkrs
@@ -1074,16 +1075,16 @@ def do_kmeans_clustering(
10741075
10751076 # Get sim matrix
10761077 sim_mat = clust_obj .get_sim_mat (diary_obj .stat1 )
1077- prunned_sim_mat = clust_obj .p_pruning (sim_mat , p_val )
1078+ pruned_sim_mat = clust_obj .p_pruning (sim_mat , p_val )
10781079
10791080 # Symmetrization
1080- sym_prund_sim_mat = 0.5 * (prunned_sim_mat + prunned_sim_mat .T )
1081+ sym_pruned_sim_mat = 0.5 * (pruned_sim_mat + pruned_sim_mat .T )
10811082
10821083 # Laplacian calculation
1083- laplacian = clust_obj .get_laplacian (sym_prund_sim_mat )
1084+ laplacian = clust_obj .get_laplacian (sym_pruned_sim_mat )
10841085
10851086 # Get Spectral Embeddings
1086- emb , num_of_spk = clust_obj .get_spec_embs (laplacian , k_oracle )
1087+ _ , num_of_spk = clust_obj .get_spec_embs (laplacian , k_oracle )
10871088
10881089 # Perform kmeans directly on deep embeddings
10891090 _ , labels , _ = k_means (diary_obj .stat1 , num_of_spk )
0 commit comments