Petr Tsvetkov
commited on
Commit
β’
ff76f88
1
Parent(s):
aef1dbe
Add the aggregated correlations table
Browse files
change_visualizer.py
CHANGED
@@ -110,8 +110,8 @@ if __name__ == '__main__':
|
|
110 |
gr.Markdown(f"### Reference-only correlations")
|
111 |
gr.Markdown(value=analysis_util.get_correlations_for_groups(df_synthetic, right_side="ind").to_markdown())
|
112 |
|
113 |
-
|
114 |
-
|
115 |
|
116 |
application.load(update_dataset_view_manual, inputs=slider_manual,
|
117 |
outputs=view_manual)
|
|
|
110 |
gr.Markdown(f"### Reference-only correlations")
|
111 |
gr.Markdown(value=analysis_util.get_correlations_for_groups(df_synthetic, right_side="ind").to_markdown())
|
112 |
|
113 |
+
gr.Markdown(f"### Aggregated correlations")
|
114 |
+
gr.Markdown(value=analysis_util.get_correlations_for_groups(df_synthetic, right_side="aggr").to_markdown())
|
115 |
|
116 |
application.load(update_dataset_view_manual, inputs=slider_manual,
|
117 |
outputs=view_manual)
|
generation_steps/metrics_analysis.py
CHANGED
@@ -1,6 +1,3 @@
|
|
1 |
-
import functools
|
2 |
-
import operator
|
3 |
-
|
4 |
import Levenshtein
|
5 |
import evaluate
|
6 |
import pandas as pd
|
@@ -85,6 +82,7 @@ def edit_distance_fn(pred, ref, **kwargs):
|
|
85 |
return sum(scores) / len(scores)
|
86 |
return Levenshtein.distance(pred, ref)
|
87 |
|
|
|
88 |
def edit_distance_norm_fn(pred, ref, **kwargs):
|
89 |
if "refs" in kwargs:
|
90 |
scores = [Levenshtein.distance(pred, ref) / len(pred) for ref in kwargs["refs"]]
|
@@ -227,7 +225,6 @@ def compute_metrics(df):
|
|
227 |
return df
|
228 |
|
229 |
|
230 |
-
|
231 |
def compute_correlations(df: pd.DataFrame):
|
232 |
grouped_df = df.groupby(by=["end_to_start", "start_to_end"])
|
233 |
correlations = grouped_df.apply(correlations_for_group, include_groups=False)
|
|
|
|
|
|
|
|
|
1 |
import Levenshtein
|
2 |
import evaluate
|
3 |
import pandas as pd
|
|
|
82 |
return sum(scores) / len(scores)
|
83 |
return Levenshtein.distance(pred, ref)
|
84 |
|
85 |
+
|
86 |
def edit_distance_norm_fn(pred, ref, **kwargs):
|
87 |
if "refs" in kwargs:
|
88 |
scores = [Levenshtein.distance(pred, ref) / len(pred) for ref in kwargs["refs"]]
|
|
|
225 |
return df
|
226 |
|
227 |
|
|
|
228 |
def compute_correlations(df: pd.DataFrame):
|
229 |
grouped_df = df.groupby(by=["end_to_start", "start_to_end"])
|
230 |
correlations = grouped_df.apply(correlations_for_group, include_groups=False)
|