Spaces:
Sleeping
Sleeping
EduardoPacheco
commited on
Commit
•
c4b39af
1
Parent(s):
924f848
Changed plot look
Browse files
app.py
CHANGED
@@ -43,9 +43,6 @@ def app_fn(n_random_features: int, test_size: float, random_state_val: int):
|
|
43 |
|
44 |
return fig_bin, fig_multi
|
45 |
|
46 |
-
def app_fn_multi():
|
47 |
-
...
|
48 |
-
|
49 |
|
50 |
title = "Precision-Recall Curves"
|
51 |
with gr.Blocks(title=title) as demo:
|
@@ -68,7 +65,7 @@ with gr.Blocks(title=title) as demo:
|
|
68 |
|
69 |
with gr.Row():
|
70 |
n_random_features = gr.inputs.Slider(0, 1000, 50, 800,label="Number of Random Features")
|
71 |
-
test_size = gr.inputs.Slider(0.1, 0.9, 0.
|
72 |
random_state_val = gr.inputs.Slider(0, 100, 5, 0,label="Random State")
|
73 |
|
74 |
|
@@ -79,6 +76,7 @@ with gr.Blocks(title=title) as demo:
|
|
79 |
n_random_features.change(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
80 |
test_size.change(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
81 |
random_state_val.change(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
|
|
82 |
demo.load(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
83 |
|
84 |
demo.launch()
|
|
|
43 |
|
44 |
return fig_bin, fig_multi
|
45 |
|
|
|
|
|
|
|
46 |
|
47 |
title = "Precision-Recall Curves"
|
48 |
with gr.Blocks(title=title) as demo:
|
|
|
65 |
|
66 |
with gr.Row():
|
67 |
n_random_features = gr.inputs.Slider(0, 1000, 50, 800,label="Number of Random Features")
|
68 |
+
test_size = gr.inputs.Slider(0.1, 0.9, 0.01, 0.5, label="Test Size")
|
69 |
random_state_val = gr.inputs.Slider(0, 100, 5, 0,label="Random State")
|
70 |
|
71 |
|
|
|
76 |
n_random_features.change(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
77 |
test_size.change(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
78 |
random_state_val.change(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
79 |
+
|
80 |
demo.load(fn=app_fn, inputs=[n_random_features, test_size, random_state_val], outputs=[fig_bin, fig_multi])
|
81 |
|
82 |
demo.launch()
|
utils.py
CHANGED
@@ -30,9 +30,9 @@ def plot_multi_label_pr_curve(clf, X_test: np.ndarray, Y_test: np.ndarray):
|
|
30 |
|
31 |
for color, key in zip(colors, keys):
|
32 |
if key=="micro":
|
33 |
-
name = f"Micro-average
|
34 |
else:
|
35 |
-
name = f"
|
36 |
fig.add_trace(
|
37 |
go.Scatter(
|
38 |
x=recall[key],
|
@@ -66,7 +66,7 @@ def plot_multi_label_pr_curve(clf, X_test: np.ndarray, Y_test: np.ndarray):
|
|
66 |
fig.update_layout(
|
67 |
title='Extension of Precision-Recall Curve to Multi-Class',
|
68 |
xaxis_title='Recall',
|
69 |
-
yaxis_title='Precision'
|
70 |
)
|
71 |
|
72 |
return fig
|
|
|
30 |
|
31 |
for color, key in zip(colors, keys):
|
32 |
if key=="micro":
|
33 |
+
name = f"Micro-average(AP={average_precision[key]:.2f})"
|
34 |
else:
|
35 |
+
name = f"Class {key} (AP={average_precision[key]:.2f})"
|
36 |
fig.add_trace(
|
37 |
go.Scatter(
|
38 |
x=recall[key],
|
|
|
66 |
fig.update_layout(
|
67 |
title='Extension of Precision-Recall Curve to Multi-Class',
|
68 |
xaxis_title='Recall',
|
69 |
+
yaxis_title='Precision'
|
70 |
)
|
71 |
|
72 |
return fig
|