Spaces:
Running
Running
# FIX: Force outliers (Topic -1) to be "Unlabelled" so we can hide them
Browse files
app.py
CHANGED
|
@@ -1240,15 +1240,45 @@ else:
|
|
| 1240 |
# mask = topics_arr != -1
|
| 1241 |
# reduced_plot = reduced[mask]
|
| 1242 |
# labs = list(np.asarray(labs_all)[mask])
|
| 1243 |
-
|
| 1244 |
-
|
| 1245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1246 |
|
| 1247 |
# VISUALISATION
|
| 1248 |
st.subheader("Experiential Topics Visualisation")
|
| 1249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1250 |
st.pyplot(fig)
|
| 1251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1252 |
st.subheader("Topic Info")
|
| 1253 |
st.dataframe(tm.get_topic_info())
|
| 1254 |
|
|
|
|
| 1240 |
# mask = topics_arr != -1
|
| 1241 |
# reduced_plot = reduced[mask]
|
| 1242 |
# labs = list(np.asarray(labs_all)[mask])
|
| 1243 |
+
|
| 1244 |
+
|
| 1245 |
+
|
| 1246 |
+
|
| 1247 |
+
#try remove -1 outliers topics
|
| 1248 |
+
|
| 1249 |
+
# FIX: Force outliers (Topic -1) to be "Unlabelled" so we can hide them
|
| 1250 |
+
labs = []
|
| 1251 |
+
for t in tm.topics_:
|
| 1252 |
+
if t == -1:
|
| 1253 |
+
labs.append("Unlabelled")
|
| 1254 |
+
else:
|
| 1255 |
+
labs.append(llm_names.get(t, "Unlabelled"))
|
| 1256 |
|
| 1257 |
# VISUALISATION
|
| 1258 |
st.subheader("Experiential Topics Visualisation")
|
| 1259 |
+
|
| 1260 |
+
# We pass 'noise_label' and 'noise_color' to grey out the outliers
|
| 1261 |
+
fig, _ = datamapplot.create_plot(
|
| 1262 |
+
reduced,
|
| 1263 |
+
labs,
|
| 1264 |
+
noise_label="Unlabelled", # Tells datamapplot: "Do not put a text label on this group"
|
| 1265 |
+
noise_color="#CCCCCC", # Sets the points to a light Grey
|
| 1266 |
+
label_font_size=11, # Optional: Adjust font size
|
| 1267 |
+
arrowprops={"arrowstyle": "-", "color": "#333333"} # Optional: darker, simpler arrows
|
| 1268 |
+
)
|
| 1269 |
st.pyplot(fig)
|
| 1270 |
|
| 1271 |
+
|
| 1272 |
+
# labs = [llm_names.get(t, "Unlabelled") for t in tm.topics_]
|
| 1273 |
+
# ##### ADDED FOR LLM (END)
|
| 1274 |
+
|
| 1275 |
+
# # VISUALISATION
|
| 1276 |
+
# st.subheader("Experiential Topics Visualisation")
|
| 1277 |
+
# fig, _ = datamapplot.create_plot(reduced, labs)
|
| 1278 |
+
# st.pyplot(fig)
|
| 1279 |
+
|
| 1280 |
+
|
| 1281 |
+
|
| 1282 |
st.subheader("Topic Info")
|
| 1283 |
st.dataframe(tm.get_topic_info())
|
| 1284 |
|