@@ -69,7 +69,7 @@ def analyze_extreme_features():
6969
7070 feature_distances = np .array (feature_distances )
7171
72- print (f "Feature space distances (standardized by std):" )
72+ print ("Feature space distances (standardized by std):" )
7373 print (f" Min: { feature_distances .min ():.2f} std" )
7474 print (f" Max: { feature_distances .max ():.2f} std" )
7575 print (f" Mean: { feature_distances .mean ():.2f} std" )
@@ -91,7 +91,7 @@ def analyze_extreme_features():
9191
9292 # Compute position distances
9393 position_distance = kde_distance (interior_bins , enc_positions , position_std )
94- log_position_distance = log_kde_distance (interior_bins , enc_positions , position_std )
94+ log_kde_distance (interior_bins , enc_positions , position_std )
9595
9696 print ("-" * 80 )
9797 print ("ORIGINAL IMPLEMENTATION (clusterless_kde.py)" )
@@ -118,14 +118,14 @@ def analyze_extreme_features():
118118 n_inf = np .sum (np .isinf (ll_original ))
119119 n_nan = np .sum (np .isnan (ll_original ))
120120
121- print (f "Value distribution:" )
121+ print ("Value distribution:" )
122122 print (f" Finite values: { n_finite } /{ ll_original .size } ({ 100 * n_finite / ll_original .size :.1f} %)" )
123123 print (f" -Inf values: { n_inf } /{ ll_original .size } ({ 100 * n_inf / ll_original .size :.1f} %)" )
124124 print (f" NaN values: { n_nan } /{ ll_original .size } ({ 100 * n_nan / ll_original .size :.1f} %)" )
125125 print ()
126126
127127 if n_finite > 0 :
128- print (f "Finite value statistics:" )
128+ print ("Finite value statistics:" )
129129 print (f" Min: { ll_original [finite_mask ].min ():.4f} " )
130130 print (f" Max: { ll_original [finite_mask ].max ():.4f} " )
131131 print (f" Mean: { ll_original [finite_mask ].mean ():.4f} " )
@@ -167,7 +167,7 @@ def analyze_extreme_features():
167167 n_inf_log = np .sum (np .isinf (ll_log_no_gemm ))
168168 n_nan_log = np .sum (np .isnan (ll_log_no_gemm ))
169169
170- print (f "Value distribution:" )
170+ print ("Value distribution:" )
171171 print (f" Finite values: { n_finite_log } /{ ll_log_no_gemm .size } ({ 100 * n_finite_log / ll_log_no_gemm .size :.1f} %)" )
172172 print (f" -Inf values: { n_inf_log } /{ ll_log_no_gemm .size } ({ 100 * n_inf_log / ll_log_no_gemm .size :.1f} %)" )
173173 print (f" NaN values: { n_nan_log } /{ ll_log_no_gemm .size } ({ 100 * n_nan_log / ll_log_no_gemm .size :.1f} %)" )
@@ -211,14 +211,14 @@ def analyze_extreme_features():
211211 n_inf_gemm = np .sum (np .isinf (ll_log_gemm ))
212212 n_nan_gemm = np .sum (np .isnan (ll_log_gemm ))
213213
214- print (f "Value distribution:" )
214+ print ("Value distribution:" )
215215 print (f" Finite values: { n_finite_gemm } /{ ll_log_gemm .size } ({ 100 * n_finite_gemm / ll_log_gemm .size :.1f} %)" )
216216 print (f" -Inf values: { n_inf_gemm } /{ ll_log_gemm .size } ({ 100 * n_inf_gemm / ll_log_gemm .size :.1f} %)" )
217217 print (f" NaN values: { n_nan_gemm } /{ ll_log_gemm .size } ({ 100 * n_nan_gemm / ll_log_gemm .size :.1f} %)" )
218218 print ()
219219
220220 if n_finite_gemm > 0 :
221- print (f "Finite value statistics:" )
221+ print ("Finite value statistics:" )
222222 print (f" Min: { ll_log_gemm [finite_mask_gemm ].min ():.4f} " )
223223 print (f" Max: { ll_log_gemm [finite_mask_gemm ].max ():.4f} " )
224224 print (f" Mean: { ll_log_gemm [finite_mask_gemm ].mean ():.4f} " )
@@ -254,7 +254,7 @@ def analyze_extreme_features():
254254
255255 if n_finite_gemm > n_finite :
256256 improvement = n_finite_gemm - n_finite
257- print (f "✅ GEMM optimization improves numerical stability:" )
257+ print ("✅ GEMM optimization improves numerical stability:" )
258258 print (f" { improvement } more finite values ({ 100 * improvement / ll_original .size :.1f} % of total)" )
259259 print ()
260260 print (" The GEMM approach computes in log-space throughout," )
@@ -289,7 +289,7 @@ def analyze_extreme_features():
289289 if n_finite_gemm > n_finite * 1.1 : # At least 10% improvement
290290 print ("**Use GEMM optimization for extreme features**" )
291291 print ()
292- print (f "The GEMM approach (use_gemm=True) significantly improves" )
292+ print ("The GEMM approach (use_gemm=True) significantly improves" )
293293 print (f"numerical stability, preserving { 100 * n_finite_gemm / ll_log_gemm .size :.1f} % finite values" )
294294 print (f"vs { 100 * n_finite / ll_original .size :.1f} % for the original." )
295295 print ()
@@ -300,7 +300,7 @@ def analyze_extreme_features():
300300 else :
301301 print ("**GEMM optimization does not significantly help with extreme features**" )
302302 print ()
303- print (f "Both approaches produce similar amounts of underflow" )
303+ print ("Both approaches produce similar amounts of underflow" )
304304 print (f"({ 100 * n_finite / ll_original .size :.1f} % vs { 100 * n_finite_gemm / ll_log_gemm .size :.1f} % finite)." )
305305 print ()
306306 print ("With such extreme feature distances, underflow is unavoidable." )
0 commit comments