Spaces:
Runtime error
Runtime error
legend interactive
Browse files
app.py
CHANGED
|
@@ -62,7 +62,7 @@ def down_samp(embedding):
|
|
| 62 |
|
| 63 |
|
| 64 |
def data_comparison(df):
|
| 65 |
-
selection = alt.selection_multi(fields=['cluster
|
| 66 |
color = alt.condition(alt.datum.slice == 'high-loss', alt.Color('cluster:N', scale = alt.Scale(domain=df.cluster.unique().tolist())), alt.value("lightgray"))
|
| 67 |
opacity = alt.condition(selection, alt.value(0.7), alt.value(0.25))
|
| 68 |
|
|
@@ -71,8 +71,8 @@ def data_comparison(df):
|
|
| 71 |
x=alt.X('x:Q', axis=None),
|
| 72 |
y=alt.Y('y:Q', axis=None),
|
| 73 |
color=color,
|
| 74 |
-
shape=alt.Shape('label:
|
| 75 |
-
tooltip=['cluster:N','slice:N','content:N','label:
|
| 76 |
opacity=opacity
|
| 77 |
).properties(
|
| 78 |
width=1000,
|
|
@@ -80,9 +80,9 @@ def data_comparison(df):
|
|
| 80 |
).interactive()
|
| 81 |
|
| 82 |
legend = alt.Chart(df).mark_point(size=100, filled=True).encode(
|
| 83 |
-
x=alt.X("label
|
| 84 |
y=alt.Y('cluster:N', axis=alt.Axis(orient='right'), title=""),
|
| 85 |
-
shape=alt.Shape('label:
|
| 86 |
range=['circle', 'diamond']), legend=None),
|
| 87 |
color=color,
|
| 88 |
).add_selection(
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def data_comparison(df):
|
| 65 |
+
selection = alt.selection_multi(fields=['cluster','label'])
|
| 66 |
color = alt.condition(alt.datum.slice == 'high-loss', alt.Color('cluster:N', scale = alt.Scale(domain=df.cluster.unique().tolist())), alt.value("lightgray"))
|
| 67 |
opacity = alt.condition(selection, alt.value(0.7), alt.value(0.25))
|
| 68 |
|
|
|
|
| 71 |
x=alt.X('x:Q', axis=None),
|
| 72 |
y=alt.Y('y:Q', axis=None),
|
| 73 |
color=color,
|
| 74 |
+
shape=alt.Shape('label:N', scale=alt.Scale(range=['circle', 'diamond'])),
|
| 75 |
+
tooltip=['cluster:N','slice:N','content:N','label:N','pred:O'],
|
| 76 |
opacity=opacity
|
| 77 |
).properties(
|
| 78 |
width=1000,
|
|
|
|
| 80 |
).interactive()
|
| 81 |
|
| 82 |
legend = alt.Chart(df).mark_point(size=100, filled=True).encode(
|
| 83 |
+
x=alt.X("label"),
|
| 84 |
y=alt.Y('cluster:N', axis=alt.Axis(orient='right'), title=""),
|
| 85 |
+
shape=alt.Shape('label:N', scale=alt.Scale(
|
| 86 |
range=['circle', 'diamond']), legend=None),
|
| 87 |
color=color,
|
| 88 |
).add_selection(
|