Ryan commited on
Commit
fecdfa0
·
1 Parent(s): ce0a41c
Files changed (1) hide show
  1. visualization/bow_visualizer.py +0 -37
visualization/bow_visualizer.py CHANGED
@@ -68,30 +68,6 @@ def create_bow_visualization(analysis_results):
68
 
69
  output_components.append(gr.Plot(value=fig))
70
 
71
- # Show comparison metrics
72
- comparisons = bow_results.get("comparisons", {})
73
- if comparisons:
74
- for comparison_key, metrics in comparisons.items():
75
- output_components.append(gr.Markdown(f"### Similarity Metrics for {comparison_key}"))
76
-
77
- # Format metrics for better display
78
- if "jaccard_similarity" in metrics:
79
- output_components.append(gr.Markdown(
80
- f"- **Jaccard Similarity**: {metrics['jaccard_similarity']:.2f} "
81
- f"(measures word overlap between responses)"
82
- ))
83
-
84
- if "cosine_similarity" in metrics:
85
- output_components.append(gr.Markdown(
86
- f"- **Cosine Similarity**: {metrics['cosine_similarity']:.2f} "
87
- f"(measures how similar the word frequency distributions are)"
88
- ))
89
-
90
- if "common_word_count" in metrics:
91
- output_components.append(gr.Markdown(
92
- f"- **Common Words**: {metrics['common_word_count']} words appear in both responses"
93
- ))
94
-
95
  # Visualize differential words (words with biggest frequency difference)
96
  diff_words = bow_results.get("differential_words", [])
97
  word_matrix = bow_results.get("word_count_matrix", {})
@@ -190,19 +166,6 @@ def process_and_visualize_analysis(analysis_results):
190
  word_list = [f"{item['word']} ({item['count']})" for item in words[:10]]
191
  components.append(gr.Markdown(f"**{model}**: {', '.join(word_list)}"))
192
 
193
- # Display comparison metrics
194
- if "comparisons" in bow_results:
195
- components.append(gr.Markdown("#### Similarity Metrics"))
196
-
197
- for comparison, metrics in bow_results["comparisons"].items():
198
- cosine = metrics.get("cosine_similarity", 0)
199
- jaccard = metrics.get("jaccard_similarity", 0)
200
- components.append(gr.Markdown(
201
- f"**{comparison}**:\n"
202
- f"- Cosine similarity: {cosine:.2f}\n"
203
- f"- Jaccard similarity: {jaccard:.2f}"
204
- ))
205
-
206
  # Add visualizations for word frequency differences
207
  if "differential_words" in bow_results and "word_count_matrix" in bow_results and len(bow_results["models"]) >= 2:
208
  diff_words = bow_results["differential_words"]
 
68
 
69
  output_components.append(gr.Plot(value=fig))
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  # Visualize differential words (words with biggest frequency difference)
72
  diff_words = bow_results.get("differential_words", [])
73
  word_matrix = bow_results.get("word_count_matrix", {})
 
166
  word_list = [f"{item['word']} ({item['count']})" for item in words[:10]]
167
  components.append(gr.Markdown(f"**{model}**: {', '.join(word_list)}"))
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  # Add visualizations for word frequency differences
170
  if "differential_words" in bow_results and "word_count_matrix" in bow_results and len(bow_results["models"]) >= 2:
171
  diff_words = bow_results["differential_words"]