ultima versao
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import matplotlib.pyplot as plt
|
|
4 |
import numpy as np
|
5 |
import csv
|
6 |
from scipy.stats import wilcoxon
|
|
|
7 |
|
8 |
LIBRARIES = ["ALOY", "APSTUD", "CLI", "CLOV", "COMPASS", "CONFCLOUD", "CONFSERVER", "DAEMON", "DM", "DNN", "DURACLOUD", "EVG", "FAB",
|
9 |
"MDL", "MESOS" ,"MULE", "NEXUS", "SERVER", "STL", "TIDOC", "TIMOB", "TISTUD", "XD"]
|
@@ -13,44 +14,52 @@ def grafico(list_output_MbR, list_output_NEOSP, nome_projeto, pip_choices):
|
|
13 |
df = pd.DataFrame(list_results, columns=["Model", "MAE"])
|
14 |
df_list_output_MbR = pd.DataFrame(list_output_MbR, columns=["MAE"])
|
15 |
df_list_output_NEOSP = pd.DataFrame(list_output_NEOSP, columns=["MAE"])
|
16 |
-
fig,
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
# ax1
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
if "MbR Regressor" in pip_choices:
|
23 |
-
|
24 |
if "NEOSP-SVR Regressor" in pip_choices:
|
25 |
-
|
26 |
|
27 |
# ax2
|
28 |
-
|
29 |
-
|
30 |
if "MbR Regressor" in pip_choices:
|
31 |
-
graf1 =
|
32 |
-
|
33 |
if "NEOSP-SVR Regressor" in pip_choices:
|
34 |
-
graf2 =
|
35 |
-
|
36 |
|
37 |
-
ax3
|
38 |
-
|
|
|
39 |
if "MbR Regressor" in pip_choices:
|
40 |
-
|
41 |
if "NEOSP-SVR Regressor" in pip_choices:
|
42 |
-
|
43 |
|
44 |
# graficos geral
|
45 |
fig.set_figwidth(15)
|
46 |
-
fig.set_figheight(
|
47 |
fig.suptitle("Projeto {}".format(nome_projeto))
|
48 |
# text
|
49 |
|
50 |
resultado = ""
|
51 |
-
if
|
52 |
res = wilcoxon(list_output_MbR, list_output_NEOSP)
|
53 |
-
resultado = "MbR vs. NEOSP-SVR
|
54 |
|
55 |
return gr.update(value=plt, visible=True), gr.update(value=resultado, visible=True)
|
56 |
|
@@ -86,8 +95,9 @@ with demo:
|
|
86 |
fetch = gr.Button(value="Fetch")
|
87 |
with gr.Row():
|
88 |
with gr.Column():
|
|
|
89 |
pip_plot = gr.Plot(visible=False)
|
90 |
-
|
91 |
# issue_plot = gr.Plot(visible=False)
|
92 |
|
93 |
fetch.click(create_pip_plot, inputs=[libraries, pip], outputs=[pip_plot, star_plot])
|
|
|
4 |
import numpy as np
|
5 |
import csv
|
6 |
from scipy.stats import wilcoxon
|
7 |
+
import matplotlib.gridspec as gridspec
|
8 |
|
9 |
LIBRARIES = ["ALOY", "APSTUD", "CLI", "CLOV", "COMPASS", "CONFCLOUD", "CONFSERVER", "DAEMON", "DM", "DNN", "DURACLOUD", "EVG", "FAB",
|
10 |
"MDL", "MESOS" ,"MULE", "NEXUS", "SERVER", "STL", "TIDOC", "TIMOB", "TISTUD", "XD"]
|
|
|
14 |
df = pd.DataFrame(list_results, columns=["Model", "MAE"])
|
15 |
df_list_output_MbR = pd.DataFrame(list_output_MbR, columns=["MAE"])
|
16 |
df_list_output_NEOSP = pd.DataFrame(list_output_NEOSP, columns=["MAE"])
|
17 |
+
fig, ax = plt.subplots(2, 2)
|
18 |
+
|
19 |
+
G = gridspec.GridSpec(2, 2)
|
20 |
+
axes_1 = plt.subplot(G[0, :])
|
21 |
+
axes_2 = plt.subplot(G[1, 0])
|
22 |
+
axes_3 = plt.subplot(G[1, 1])
|
23 |
|
24 |
# ax1
|
25 |
+
axes_1.set_xlabel("Index Execução")
|
26 |
+
axes_1.set_ylabel("MAE")
|
27 |
+
axes_1.legend()
|
28 |
+
axes_1.grid(True, which = "both", axis = "x" )
|
29 |
+
axes_1.minorticks_on()
|
30 |
if "MbR Regressor" in pip_choices:
|
31 |
+
axes_1.scatter(range(1,51), df_list_output_MbR["MAE"].loc[1:50], label="MbR Regressor", color="red", alpha=0.5,)
|
32 |
if "NEOSP-SVR Regressor" in pip_choices:
|
33 |
+
axes_1.scatter(range(1,51), df_list_output_NEOSP["MAE"].loc[1:50], label="NEOSP-SVR Regressor", color = "blue", alpha=0.5)
|
34 |
|
35 |
# ax2
|
36 |
+
axes_2.set_ylabel("MAE Médio")
|
37 |
+
axes_2.set_xlabel("Modelos")
|
38 |
if "MbR Regressor" in pip_choices:
|
39 |
+
graf1 = axes_2.bar(df["Model"].iloc[[0]], df["MAE"].iloc[[0]], color="red", alpha=0.5)
|
40 |
+
axes_2.bar_label(graf1, fmt="%.01f", size=10, label_type="edge")
|
41 |
if "NEOSP-SVR Regressor" in pip_choices:
|
42 |
+
graf2 = axes_2.bar(df["Model"].iloc[[1]], df["MAE"].iloc[[1]], color = "blue", alpha=0.5)
|
43 |
+
axes_2.bar_label(graf2, fmt="%.01f", size=10, label_type="edge")
|
44 |
|
45 |
+
# ax3
|
46 |
+
axes_3.set_xlabel("MAE")
|
47 |
+
axes_3.set_ylabel("Frequência")
|
48 |
if "MbR Regressor" in pip_choices:
|
49 |
+
axes_3.hist(df_list_output_MbR["MAE"], color="red", alpha=0.5)
|
50 |
if "NEOSP-SVR Regressor" in pip_choices:
|
51 |
+
axes_3.hist(df_list_output_NEOSP["MAE"], color="blue", alpha=0.5)
|
52 |
|
53 |
# graficos geral
|
54 |
fig.set_figwidth(15)
|
55 |
+
fig.set_figheight(8)
|
56 |
fig.suptitle("Projeto {}".format(nome_projeto))
|
57 |
# text
|
58 |
|
59 |
resultado = ""
|
60 |
+
if (pip_choices == ["NEOSP-SVR Regressor", "MbR Regressor"]) or (pip_choices == ["MbR Regressor", "NEOSP-SVR Regressor"]):
|
61 |
res = wilcoxon(list_output_MbR, list_output_NEOSP)
|
62 |
+
resultado = "MbR vs. NEOSP-SVR => Statistics: {} | valor-p: {}".format(res.statistic, res.pvalue)
|
63 |
|
64 |
return gr.update(value=plt, visible=True), gr.update(value=resultado, visible=True)
|
65 |
|
|
|
95 |
fetch = gr.Button(value="Fetch")
|
96 |
with gr.Row():
|
97 |
with gr.Column():
|
98 |
+
star_plot = gr.Text(visible=False, label="Wilcoxon Test")
|
99 |
pip_plot = gr.Plot(visible=False)
|
100 |
+
|
101 |
# issue_plot = gr.Plot(visible=False)
|
102 |
|
103 |
fetch.click(create_pip_plot, inputs=[libraries, pip], outputs=[pip_plot, star_plot])
|