Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -113,6 +113,13 @@ def plot_tsne(tech_filter, snr_filter, mod_filter, mob_filter, representation, c
|
|
| 113 |
|
| 114 |
filtered_df['x'] = projections[:, 0]
|
| 115 |
filtered_df['y'] = projections[:, 1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
x_min, x_max = filtered_df['x'].min(), filtered_df['x'].max()
|
| 117 |
y_min, y_max = filtered_df['y'].min(), filtered_df['y'].max()
|
| 118 |
x_pad = max(1e-3, (x_max - x_min) * 0.05)
|
|
@@ -133,7 +140,8 @@ def plot_tsne(tech_filter, snr_filter, mod_filter, mob_filter, representation, c
|
|
| 133 |
fig.update_xaxes(range=[x_min - x_pad, x_max + x_pad])
|
| 134 |
fig.update_yaxes(range=[y_min - y_pad, y_max + y_pad])
|
| 135 |
|
| 136 |
-
|
|
|
|
| 137 |
|
| 138 |
# Convenience preset: single-tech, modulation-colored embedding view
|
| 139 |
def quick_modulation_plot():
|
|
|
|
| 113 |
|
| 114 |
filtered_df['x'] = projections[:, 0]
|
| 115 |
filtered_df['y'] = projections[:, 1]
|
| 116 |
+
# If t-SNE collapses to a line/point, add tiny jitter so points are visible.
|
| 117 |
+
x_span = filtered_df['x'].max() - filtered_df['x'].min()
|
| 118 |
+
y_span = filtered_df['y'].max() - filtered_df['y'].min()
|
| 119 |
+
if x_span < 1e-6:
|
| 120 |
+
filtered_df['x'] += np.random.normal(scale=1e-3, size=len(filtered_df))
|
| 121 |
+
if y_span < 1e-6:
|
| 122 |
+
filtered_df['y'] += np.random.normal(scale=1e-3, size=len(filtered_df))
|
| 123 |
x_min, x_max = filtered_df['x'].min(), filtered_df['x'].max()
|
| 124 |
y_min, y_max = filtered_df['y'].min(), filtered_df['y'].max()
|
| 125 |
x_pad = max(1e-3, (x_max - x_min) * 0.05)
|
|
|
|
| 140 |
fig.update_xaxes(range=[x_min - x_pad, x_max + x_pad])
|
| 141 |
fig.update_yaxes(range=[y_min - y_pad, y_max + y_pad])
|
| 142 |
|
| 143 |
+
coord_info = f"x[{x_min:.3f},{x_max:.3f}] y[{y_min:.3f},{y_max:.3f}]"
|
| 144 |
+
return fig, f"{status_msg} | filtered samples: {len(filtered_df)} | {coord_info}"
|
| 145 |
|
| 146 |
# Convenience preset: single-tech, modulation-colored embedding view
|
| 147 |
def quick_modulation_plot():
|