giseldo commited on
Commit
1dcc182
·
1 Parent(s): 48cc4ca

ultima versao

Browse files
Files changed (1) hide show
  1. app.py +30 -20
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, (ax1, ax2, ax3)= plt.subplots(1, 3)
 
 
 
 
 
17
 
18
  # ax1
19
- ax1.set_xlabel("Index Execução")
20
- ax1.set_ylabel("MAE")
21
- ax1.legend()
 
 
22
  if "MbR Regressor" in pip_choices:
23
- ax1.plot(df_list_output_MbR.index, df_list_output_MbR["MAE"], label="MbR Regressor", color="red", alpha=0.5)
24
  if "NEOSP-SVR Regressor" in pip_choices:
25
- ax1.plot(df_list_output_NEOSP.index, df_list_output_NEOSP["MAE"], label="NEOSP-SVR Regressor", color="blue", alpha=0.5)
26
 
27
  # ax2
28
- ax2.set_ylabel("MAE Médio")
29
- ax2.set_xlabel("Modelos")
30
  if "MbR Regressor" in pip_choices:
31
- graf1 = ax2.bar(df["Model"].iloc[[0]], df["MAE"].iloc[[0]], color="red", alpha=0.5)
32
- ax2.bar_label(graf1, fmt="%.01f", size=10, label_type="edge")
33
  if "NEOSP-SVR Regressor" in pip_choices:
34
- graf2 = ax2.bar(df["Model"].iloc[[1]], df["MAE"].iloc[[1]], color = "blue", alpha=0.5)
35
- ax2.bar_label(graf2, fmt="%.01f", size=10, label_type="edge")
36
 
37
- ax3.set_xlabel("MAE")
38
- ax3.set_ylabel("Frequência")
 
39
  if "MbR Regressor" in pip_choices:
40
- ax3.hist(df_list_output_MbR["MAE"], color="red", alpha=0.5)
41
  if "NEOSP-SVR Regressor" in pip_choices:
42
- ax3.hist(df_list_output_NEOSP["MAE"], color="blue", alpha=0.5)
43
 
44
  # graficos geral
45
  fig.set_figwidth(15)
46
- fig.set_figheight(4)
47
  fig.suptitle("Projeto {}".format(nome_projeto))
48
  # text
49
 
50
  resultado = ""
51
- if ("MbR Regressor" and "NEOSP-SVR Regressor") in pip_choices:
52
  res = wilcoxon(list_output_MbR, list_output_NEOSP)
53
- resultado = "MbR vs. NEOSP-SVR -> Wilcoxon -> Statistics: {} | valor-p: {}".format(res.statistic, res.pvalue)
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
- star_plot = gr.Text(visible=False)
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])