Spaces:
Build error
Build error
som names changed
Browse files- app.py +2 -2
- funcs/som.py +4 -4
app.py
CHANGED
@@ -309,8 +309,8 @@ with gr.Blocks(title='Cabasus') as cabasus_sensor:
|
|
309 |
plot_box_leg = gr.Plot(label="Filtered Signal Plot")
|
310 |
slice_slider = gr.Slider(minimum=1, maximum=300, label='Slice select', step=1)
|
311 |
|
312 |
-
som_create = gr.Button('generate
|
313 |
-
som_figures = gr.Plot(label="
|
314 |
|
315 |
with gr.Row():
|
316 |
slice_size_slider = gr.Slider(minimum=16, maximum=512, step=1, value=64, label="Slice Size", visible=False)
|
|
|
309 |
plot_box_leg = gr.Plot(label="Filtered Signal Plot")
|
310 |
slice_slider = gr.Slider(minimum=1, maximum=300, label='Slice select', step=1)
|
311 |
|
312 |
+
som_create = gr.Button('generate activation maps')
|
313 |
+
som_figures = gr.Plot(label="activations maps")
|
314 |
|
315 |
with gr.Row():
|
316 |
slice_size_slider = gr.Slider(minimum=16, maximum=512, step=1, value=64, label="Slice Size", visible=False)
|
funcs/som.py
CHANGED
@@ -145,7 +145,7 @@ class ClusterSOM:
|
|
145 |
fig, axes = self.rearrange_subplots(len(self.som_models))
|
146 |
|
147 |
# fig, axes = plt.subplots(1, len(self.som_models), figsize=(20, 5), sharex=True, sharey=True)
|
148 |
-
fig.suptitle(f"Activation map for
|
149 |
|
150 |
for idx, (som_key, som) in enumerate(self.som_models.items()):
|
151 |
ax = axes[idx]
|
@@ -229,7 +229,7 @@ class ClusterSOM:
|
|
229 |
prediction = self.predict([data[int(slice_select)-2]])[0]
|
230 |
|
231 |
fig, axes = plt.subplots(1, len(self.som_models), figsize=(20, 5), sharex=True, sharey=True)
|
232 |
-
fig.suptitle(f"Activation map for
|
233 |
|
234 |
for idx, (som_key, som) in enumerate(self.som_models.items()):
|
235 |
ax = axes[idx]
|
@@ -244,13 +244,13 @@ class ClusterSOM:
|
|
244 |
if som_key == prediction[0]: # Active SOM
|
245 |
im_active = ax.imshow(activation_map, cmap='viridis', origin='lower', interpolation='none')
|
246 |
ax.plot(winner[1], winner[0], 'r+') # Mark the BMU with a red plus sign
|
247 |
-
ax.set_title(f"
|
248 |
if hasattr(self, 'label_centroids'):
|
249 |
label_idx = self.label_encodings.inverse_transform([som_key - 1])[0]
|
250 |
ax.set_xlabel(f"Label: {label_idx}", fontsize=12)
|
251 |
else: # Inactive SOM
|
252 |
im_inactive = ax.imshow(activation_map, cmap='gray', origin='lower', interpolation='none')
|
253 |
-
ax.set_title(f"
|
254 |
|
255 |
ax.set_xticks(range(activation_map.shape[1]))
|
256 |
ax.set_yticks(range(activation_map.shape[0]))
|
|
|
145 |
fig, axes = self.rearrange_subplots(len(self.som_models))
|
146 |
|
147 |
# fig, axes = plt.subplots(1, len(self.som_models), figsize=(20, 5), sharex=True, sharey=True)
|
148 |
+
fig.suptitle(f"Activation map for A {prediction[0]}, node {prediction[1]}", fontsize=16)
|
149 |
|
150 |
for idx, (som_key, som) in enumerate(self.som_models.items()):
|
151 |
ax = axes[idx]
|
|
|
229 |
prediction = self.predict([data[int(slice_select)-2]])[0]
|
230 |
|
231 |
fig, axes = plt.subplots(1, len(self.som_models), figsize=(20, 5), sharex=True, sharey=True)
|
232 |
+
fig.suptitle(f"Activation map for A {prediction[0]}, node {prediction[1]}", fontsize=16)
|
233 |
|
234 |
for idx, (som_key, som) in enumerate(self.som_models.items()):
|
235 |
ax = axes[idx]
|
|
|
244 |
if som_key == prediction[0]: # Active SOM
|
245 |
im_active = ax.imshow(activation_map, cmap='viridis', origin='lower', interpolation='none')
|
246 |
ax.plot(winner[1], winner[0], 'r+') # Mark the BMU with a red plus sign
|
247 |
+
ax.set_title(f"A {som_key}", color='blue', fontweight='bold')
|
248 |
if hasattr(self, 'label_centroids'):
|
249 |
label_idx = self.label_encodings.inverse_transform([som_key - 1])[0]
|
250 |
ax.set_xlabel(f"Label: {label_idx}", fontsize=12)
|
251 |
else: # Inactive SOM
|
252 |
im_inactive = ax.imshow(activation_map, cmap='gray', origin='lower', interpolation='none')
|
253 |
+
ax.set_title(f"A {som_key}")
|
254 |
|
255 |
ax.set_xticks(range(activation_map.shape[1]))
|
256 |
ax.set_yticks(range(activation_map.shape[0]))
|