Spaces:
Runtime error
Runtime error
Alexander Seifert
commited on
Commit
·
e18be25
1
Parent(s):
a2351d6
improve descriptions
Browse files- subpages/losses.py +4 -1
- subpages/lossy_samples.py +9 -0
- subpages/metrics.py +3 -0
- subpages/random_samples.py +1 -1
- utils.py +3 -3
subpages/losses.py
CHANGED
@@ -34,6 +34,9 @@ class LossesPage(Page):
|
|
34 |
st.title(self.name)
|
35 |
with st.expander("💡", expanded=True):
|
36 |
st.write("Show count, mean and median loss per token and label.")
|
|
|
|
|
|
|
37 |
|
38 |
col1, _, col2 = st.columns([8, 1, 6])
|
39 |
|
@@ -54,7 +57,7 @@ class LossesPage(Page):
|
|
54 |
# st.dataframe(loss_by_label)
|
55 |
|
56 |
st.write(
|
57 |
-
"
|
58 |
)
|
59 |
|
60 |
with col2:
|
|
|
34 |
st.title(self.name)
|
35 |
with st.expander("💡", expanded=True):
|
36 |
st.write("Show count, mean and median loss per token and label.")
|
37 |
+
st.write(
|
38 |
+
"Look out for tokens that have a big gap between mean and median, indicating systematic labeling issues."
|
39 |
+
)
|
40 |
|
41 |
col1, _, col2 = st.columns([8, 1, 6])
|
42 |
|
|
|
57 |
# st.dataframe(loss_by_label)
|
58 |
|
59 |
st.write(
|
60 |
+
"_Caveat: Even though tokens have contextual representations, we average them to get these summary statistics._"
|
61 |
)
|
62 |
|
63 |
with col2:
|
subpages/lossy_samples.py
CHANGED
@@ -19,6 +19,15 @@ class LossySamplesPage(Page):
|
|
19 |
st.title(self.name)
|
20 |
with st.expander("💡", expanded=True):
|
21 |
st.write("Show every example sorted by loss (descending) for close inspection.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
st.subheader("💥 Samples ⬇loss")
|
24 |
skip_correct = st.checkbox("Skip correct examples", value=True, key="skip_correct")
|
|
|
19 |
st.title(self.name)
|
20 |
with st.expander("💡", expanded=True):
|
21 |
st.write("Show every example sorted by loss (descending) for close inspection.")
|
22 |
+
st.write(
|
23 |
+
"The **dataframe** is mostly self-explanatory. The cells are color-coded by label, a lighter color signifies a continuation label. Cells in the loss row are filled red from left to right relative to the top loss."
|
24 |
+
)
|
25 |
+
st.write(
|
26 |
+
"The **numbers to the left**: Top (black background) are sample number (listed here) and sample index (from the dataset). Below on yellow background is the total loss for the given sample."
|
27 |
+
)
|
28 |
+
st.write(
|
29 |
+
"The **annotated sample**: Every predicted entity (every token, really) gets a black border. The text color signifies the predicted label, with the first token of a sequence of token also showing the label's icon. If (and only if) the prediction is wrong, a small little box after the entity (token) contains the correct target class, with a background color corresponding to that class."
|
30 |
+
)
|
31 |
|
32 |
st.subheader("💥 Samples ⬇loss")
|
33 |
skip_correct = st.checkbox("Skip correct examples", value=True, key="skip_correct")
|
subpages/metrics.py
CHANGED
@@ -61,6 +61,9 @@ class MetricsPage(Page):
|
|
61 |
st.write(
|
62 |
"The metrics page contains precision, recall and f-score metrics as well as a confusion matrix over all the classes. By default, the confusion matrix is normalized. There's an option to zero out the diagonal, leaving only prediction errors (here it makes sense to turn off normalization, so you get raw error counts)."
|
63 |
)
|
|
|
|
|
|
|
64 |
|
65 |
eval_results = _get_evaluation(context.df)
|
66 |
if len(eval_results.splitlines()) < 8:
|
|
|
61 |
st.write(
|
62 |
"The metrics page contains precision, recall and f-score metrics as well as a confusion matrix over all the classes. By default, the confusion matrix is normalized. There's an option to zero out the diagonal, leaving only prediction errors (here it makes sense to turn off normalization, so you get raw error counts)."
|
63 |
)
|
64 |
+
st.write(
|
65 |
+
"With the confusion matrix, you don't want any of the classes to end up in the bottom right quarter: those are frequent but error-prone."
|
66 |
+
)
|
67 |
|
68 |
eval_results = _get_evaluation(context.df)
|
69 |
if len(eval_results.splitlines()) < 8:
|
subpages/random_samples.py
CHANGED
@@ -18,7 +18,7 @@ class RandomSamplesPage(Page):
|
|
18 |
st.title("🎲 Random Samples")
|
19 |
with st.expander("💡", expanded=True):
|
20 |
st.write(
|
21 |
-
"Show random samples. Simple
|
22 |
)
|
23 |
|
24 |
random_sample_size = st.number_input(
|
|
|
18 |
st.title("🎲 Random Samples")
|
19 |
with st.expander("💡", expanded=True):
|
20 |
st.write(
|
21 |
+
"Show random samples. Simple method, but it often turns up interesting things."
|
22 |
)
|
23 |
|
24 |
random_sample_size = st.number_input(
|
utils.py
CHANGED
@@ -81,12 +81,12 @@ def align_sample(row: pd.Series):
|
|
81 |
tokens[-1] += tok.lstrip("▁").lstrip("##").rstrip("@@")
|
82 |
out["tokens"] = tokens
|
83 |
|
84 |
-
if "labels" in columns:
|
85 |
-
out["labels"] = [row.labels[i] for i in indices]
|
86 |
-
|
87 |
if "preds" in columns:
|
88 |
out["preds"] = [row.preds[i] for i in indices]
|
89 |
|
|
|
|
|
|
|
90 |
if "losses" in columns:
|
91 |
out["losses"] = [row.losses[i] for i in indices]
|
92 |
|
|
|
81 |
tokens[-1] += tok.lstrip("▁").lstrip("##").rstrip("@@")
|
82 |
out["tokens"] = tokens
|
83 |
|
|
|
|
|
|
|
84 |
if "preds" in columns:
|
85 |
out["preds"] = [row.preds[i] for i in indices]
|
86 |
|
87 |
+
if "labels" in columns:
|
88 |
+
out["labels"] = [row.labels[i] for i in indices]
|
89 |
+
|
90 |
if "losses" in columns:
|
91 |
out["losses"] = [row.losses[i] for i in indices]
|
92 |
|