giseldo commited on
Commit
a4839f9
·
1 Parent(s): 5a8a0ea

ultima versao

Browse files
Files changed (1) hide show
  1. app.py +48 -34
app.py CHANGED
@@ -6,24 +6,30 @@ import statistics
6
 
7
  LIBRARIES = ["ALOY", "APSTUD", "CLI", "TIMOB", "XD"]
8
 
 
9
  def grafico(list_output_mean, list_output_neosp, nome_projeto, pip_choices):
10
- list_output_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528, 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
11
- list_output_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599, 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
12
- list_results = [ ["Median Regressor", statistics.mean(list_output_mean)], ["NEOSP-SVR Regressor", statistics.mean(list_output_NEOSP)] ]
 
 
 
13
  fig, (ax1, ax2) = plt.subplots(1, 2)
14
  # ax1
15
  if "Median Regressor" in pip_choices:
16
- df_list_output_mean = pd.DataFrame(list_output_mean, columns=["MAE"])
17
- ax1.plot(df_list_output_mean.index, df_list_output_mean["MAE"], label="Median Regressor")
 
18
  if "NEOSP-SVR Regressor" in pip_choices:
19
  df_list_output_NEOSP = pd.DataFrame(list_output_NEOSP, columns=["MAE"])
20
- ax1.plot(df_list_output_NEOSP.index, df_list_output_NEOSP["MAE"], label="NEOSP-SVR Regressor")
 
21
  ax1.set_xlabel("Index Execução")
22
  ax1.set_ylabel("MAE")
23
  ax1.legend()
24
  # ax2
25
  if "Median Regressor" or "NEOSP-SVR Regressor" in pip_choices:
26
- df = pd.DataFrame(list_results, columns = ["Model","MAE"])
27
  if "Median Regressor" in pip_choices:
28
  ax2.bar(df["Model"].iloc[[0]], df["MAE"].iloc[[0]])
29
  if "NEOSP-SVR Regressor" in pip_choices:
@@ -34,56 +40,64 @@ def grafico(list_output_mean, list_output_neosp, nome_projeto, pip_choices):
34
  ax2.set_ylabel("MAE Médio")
35
  ax2.set_xlabel("Modelos")
36
  # graficos geral
37
- fig.set_figwidth(15)
38
- fig.set_figheight(4)
39
  fig.suptitle("Projeto {}".format(nome_projeto))
40
  return gr.update(value=plt, visible=True)
41
 
 
42
  def create_pip_plot(libraries, pip_choices):
43
  if "ALOY" in libraries:
44
- list_output_ALOY_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528, 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
45
- list_output_ALOY_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599, 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
 
 
46
  return grafico(list_output_ALOY_mean, list_output_ALOY_NEOSP, "ALOY", pip_choices)
47
  elif "APSTUD" in libraries:
48
- list_output_ALOY_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528, 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
49
- list_output_ALOY_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599, 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
50
- return grafico(list_output_ALOY_mean, list_output_ALOY_NEOSP, "APSTUD", pip_choices)
51
  elif "CLI" in libraries:
52
- list_output_ALOY_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528, 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
53
- list_output_ALOY_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599, 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
54
- return grafico(list_output_ALOY_mean, list_output_ALOY_NEOSP, "CLI", pip_choices)
55
- elif "TIMOB" in libraries:
56
- list_output_ALOY_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528, 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
57
- list_output_ALOY_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599, 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
58
- return grafico(list_output_ALOY_mean, list_output_ALOY_NEOSP, "TIMOB", pip_choices)
 
 
59
  elif "XD" in libraries:
60
- list_output_ALOY_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528, 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
61
- list_output_ALOY_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599, 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
62
- return grafico(list_output_ALOY_mean, list_output_ALOY_NEOSP, "XD", pip_choices)
63
  else:
64
  return gr.update(visible=True)
65
-
 
66
  with gr.Blocks() as demo:
67
  with gr.Row():
68
  with gr.Column():
69
  gr.Markdown("## Conjunto de Dados")
70
- libraries = gr.Dropdown(choices=LIBRARIES, label="Projeto", value= "ALOY")
 
71
  with gr.Column():
72
  gr.Markdown("## Gráficos")
73
- pip = gr.CheckboxGroup(choices=["Median Regressor", "NEOSP-SVR Regressor"], label="Modelos Preditivos")
74
- #stars = gr.CheckboxGroup(choices=["Stars", "Week over Week"], label="")
75
- #issues = gr.CheckboxGroup(choices=["Issue", "Exclude org members", "week over week"], label="")
 
76
  with gr.Row():
77
  fetch = gr.Button(value="Fetch")
78
  with gr.Row():
79
  with gr.Column():
80
  pip_plot = gr.Plot(visible=False)
81
- #star_plot = gr.Plot(visible=False)
82
- #issue_plot = gr.Plot(visible=False)
83
 
84
  fetch.click(create_pip_plot, inputs=[libraries, pip], outputs=pip_plot)
85
- #fetch.click(create_star_plot, inputs=[libraries, pip], outputs=star_plot)
86
- #fetch.click(create_issue_plot, inputs=[libraries, issues], outputs=issue_plot)
87
 
88
  if __name__ == "__main__":
89
- demo.launch()
 
6
 
7
  LIBRARIES = ["ALOY", "APSTUD", "CLI", "TIMOB", "XD"]
8
 
9
+
10
  def grafico(list_output_mean, list_output_neosp, nome_projeto, pip_choices):
11
+ list_output_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528,
12
+ 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
13
+ list_output_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599,
14
+ 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
15
+ list_results = [["Median Regressor", statistics.mean(list_output_mean)], [
16
+ "NEOSP-SVR Regressor", statistics.mean(list_output_NEOSP)]]
17
  fig, (ax1, ax2) = plt.subplots(1, 2)
18
  # ax1
19
  if "Median Regressor" in pip_choices:
20
+ df_list_output_mean = pd.DataFrame(list_output_mean, columns=["MAE"])
21
+ ax1.plot(df_list_output_mean.index,
22
+ df_list_output_mean["MAE"], label="Median Regressor")
23
  if "NEOSP-SVR Regressor" in pip_choices:
24
  df_list_output_NEOSP = pd.DataFrame(list_output_NEOSP, columns=["MAE"])
25
+ ax1.plot(df_list_output_NEOSP.index,
26
+ df_list_output_NEOSP["MAE"], label="NEOSP-SVR Regressor")
27
  ax1.set_xlabel("Index Execução")
28
  ax1.set_ylabel("MAE")
29
  ax1.legend()
30
  # ax2
31
  if "Median Regressor" or "NEOSP-SVR Regressor" in pip_choices:
32
+ df = pd.DataFrame(list_results, columns=["Model", "MAE"])
33
  if "Median Regressor" in pip_choices:
34
  ax2.bar(df["Model"].iloc[[0]], df["MAE"].iloc[[0]])
35
  if "NEOSP-SVR Regressor" in pip_choices:
 
40
  ax2.set_ylabel("MAE Médio")
41
  ax2.set_xlabel("Modelos")
42
  # graficos geral
43
+ fig.set_figwidth(15)
44
+ fig.set_figheight(4)
45
  fig.suptitle("Projeto {}".format(nome_projeto))
46
  return gr.update(value=plt, visible=True)
47
 
48
+
49
  def create_pip_plot(libraries, pip_choices):
50
  if "ALOY" in libraries:
51
+ list_output_ALOY_mean = [3.152778, 3.375000, 1.423820, 1.052039, 1.297747, 1.224785, 2.250000, 2.375000, 1.540773, 1.847639, 1.491953, 1.052039, 0.983369, 1.669528,
52
+ 1.665236, 1.412554, 1.375000, 1.078326, 1.556330, 1.625000, 1.860515, 1.491953, 1.160944, 1.675966, 1.987661, 2.369099, 1.431867, 1.944742, 2.329399, 1.925429]
53
+ list_output_ALOY_NEOSP = [3.191631, 3.417342, 1.202562, 0.867979, 1.225224, 1.028501, 2.165318, 2.291910, 1.141041, 1.785504, 1.086850, 0.875381, 0.714992, 1.604599,
54
+ 1.833541, 0.860600, 1.393656, 1.152935, 1.364006, 1.647414, 1.527748, 1.236909, 1.403306, 1.655692, 1.770828, 1.937058, 0.861534, 1.341726, 1.904503, 1.449757]
55
  return grafico(list_output_ALOY_mean, list_output_ALOY_NEOSP, "ALOY", pip_choices)
56
  elif "APSTUD" in libraries:
57
+ list_output_APSTUD_mean = [5.405978260869565, 5.619565217391305, 4.4375, 4.580434782608696, 4.5, 3.5016304347826086, 1.945108695652174, 4.5, 6.836956521739131, 5.0, 3.1649456521739134, 3.309239130434783, 2.203804347826087, 3.007336956521739, 4.059782608695652, 3.296467391304348, 2.3084239130434785, 3.4937500000000004, 3.774456521739131, 3.7527173913043477, 5.465217391304348, 4.619565217391304, 4.6603260869565215, 3.0625, 2.0070652173913044, 3.059239130434783, 3.3274041937816334, 3.411279826464208, 3.7968185104844543, 8.73709327548807]
58
+ list_output_APSTUD_NEOSP = [5.41661475603331, 5.503547725525665, 4.415931210782633, 4.545322877373284, 4.536777472583356, 3.362346453641618, 1.9843639160064401, 4.470861996846005, 6.7482924452454744, 5.030760970371084, 3.4920408655032915, 3.246151689153077, 2.279240264502646, 3.0146941161291476, 4.098301193482748, 3.3288198557025104, 2.3172072884716948, 3.54395454745025, 3.7937206634843017, 3.7337097584332075, 5.521106648217923, 4.657538991789229, 4.655121901790425, 3.030783487143312, 2.0003910449758164, 3.029204865355089, 3.4122658576760707, 3.362791681092995, 3.7584358231873463, 8.847135170166245]
59
+ return grafico(list_output_APSTUD_mean, list_output_APSTUD_NEOSP, "APSTUD", pip_choices)
60
  elif "CLI" in libraries:
61
+ list_output_CLI_mean = [3.073851590106007, 0.8678445229681978, 2.225088339222615, 2.574558303886926, 2.6738515901060067, 1.57773851590106, 1.4724381625441698, 2.221554770318021, 2.5, 1.2190812720848054, 1.6420494699646642, 1.871024734982332, 2.069611307420495, 1.5, 1.9703180212014133,
62
+ 0.39081272084805657, 1.9996466431095405, 1.569257950530035, 1.4, 1.1144876325088338, 1.780565371024735, 0.9583038869257952, 1.63321554770318, 1.673317683881064, 2.0082159624413145, 1.9530516431924885, 2.335680751173709, 2.6815336463223787, 1.2699530516431925, 1.4428794992175273]
63
+ list_output_CLI_NEOSP = [3.1538037286288505, 0.937225588342782, 2.1037834307438303, 2.7185375907916134, 2.705821416930853, 1.5651596557303535, 1.1630692970019907, 2.373780602244225, 2.642528080865694, 0.8917870166563835, 1.9119725116172384, 1.895509058775452, 2.2941219868278147, 1.5548661959529118,
64
+ 2.018983040645479, 0.3002212060779503, 1.8850529066288408, 1.417942660377745, 1.3788045174949335, 1.0137659071118208, 1.4936335189563361, 0.82267957042595, 1.1580797095299311, 1.0556058690485837, 1.7453689640857384, 1.5028556447190604, 2.098886003603931, 2.7192884860222506, 1.1056835708897894, 1.4314289365223634]
65
+ return grafico(list_output_CLI_mean, list_output_CLI_NEOSP, "CLI", pip_choices)
66
+ elif "TIMOB" in libraries:
67
+ list_output_TIMOB_mean = [3.1239187095524747, 3.1127719364782216, 2.558648911447154, 3.275111760244016, 2.7384507690073105, 2.8920827752045573, 3.2534940206252116, 2.50271533011636, 2.9008521214273033, 1.9765121927601954, 2.982737682165163, 2.2250455917240934, 2.531187967012572, 1.9724129722576376,2.572886238561722, 1.768976730007113, 1.9037841682755818, 1.9127182196931205, 2.2375632557666902, 2.007052128848694, 2.139313077939234, 1.9027192358500153, 1.9491901229549842, 2.4138766385529924, 2.830769230769231, 3.545076719845544, 2.7588862920434916, 2.4929051925617314, 2.0218412762930593, 1.7311899197236056]
68
+ list_output_TIMOB_NEOSP = [3.2116159862462017, 3.196289117071299, 2.601474470400067, 3.230862677831728, 2.7402567260480617, 2.8941668879031033, 3.175745376388647, 2.4568824875229156,2.7798433043457753, 1.9535065063757133, 2.9351616923433395, 2.1850743809068365, 2.5550886930385746, 1.9154545407712529, 2.535058252004109, 1.702317100676495, 1.8854684307156933, 1.8659555544639181, 2.2476178674129246, 1.9931473638829218,2.114301637093706, 1.8737288562148644, 1.9429539400920888, 2.438826335039037, 2.8242363751209285, 3.5705528249103615, 2.773252222649539, 2.473583571405169, 1.9530287330281475, 1.687719204969839]
69
+ return grafico(list_output_TIMOB_mean, list_output_TIMOB_NEOSP, "TIMOB", pip_choices)
70
  elif "XD" in libraries:
71
+ list_output_XD_mean = [2.5098978288633456, 1.7606764928193497, 1.4100529100529098, 2.6373771730914592, 2.5485166288737724, 2.076861300075586, 2.671485260770975, 1.9914021164021165, 2.3930461073318217, 1.8410336356764927, 2.5883408919123205, 2.4966458805744516, 2.603505291005291, 2.162556689342404, 1.3380102040816326, 1.7609126984126984, 1.6026549508692367, 2.5393046107331823, 1.2452286470143614, 1.1508408919123203, 2.3851095993953133, 1.9365079365079363, 1.6403061224489799, 1.4609788359788356, 1.576436130007559, 1.5469576719576719, 1.618433484504913, 1.6909486016628874, 1.581396447467876, 1.61432350718065]
72
+ list_output_XD_NEOSP = [2.153805854606099, 1.3192041744638385, 1.0942568392224865, 2.2671338260999296, 2.2102113658193114, 1.442994939935334, 2.7211806574599327, 1.8784392297541839, 2.516598063436293, 1.8653002237732397, 2.658988020074318, 2.3855459818822085, 2.901597886872319, 2.035113280848767, 1.246124495922638, 1.7778479249011316, 1.4536318108060204, 2.661901532686688, 1.122781370408799, 1.1549609661487965, 2.3562297342031937, 1.5516294190980484, 1.4237175549652095, 1.5386608172757934, 1.4927757348680346, 1.5466779395447403, 1.543884232353307, 1.58210055276562, 1.3658819428699331, 1.3094895420260841]
73
+ return grafico(list_output_XD_mean, list_output_XD_NEOSP, "XD", pip_choices)
74
  else:
75
  return gr.update(visible=True)
76
+
77
+
78
  with gr.Blocks() as demo:
79
  with gr.Row():
80
  with gr.Column():
81
  gr.Markdown("## Conjunto de Dados")
82
+ libraries = gr.Dropdown(
83
+ choices=LIBRARIES, label="Projeto", value="ALOY")
84
  with gr.Column():
85
  gr.Markdown("## Gráficos")
86
+ pip = gr.CheckboxGroup(
87
+ choices=["Median Regressor", "NEOSP-SVR Regressor"], label="Modelos Preditivos")
88
+ # stars = gr.CheckboxGroup(choices=["Stars", "Week over Week"], label="")
89
+ # issues = gr.CheckboxGroup(choices=["Issue", "Exclude org members", "week over week"], label="")
90
  with gr.Row():
91
  fetch = gr.Button(value="Fetch")
92
  with gr.Row():
93
  with gr.Column():
94
  pip_plot = gr.Plot(visible=False)
95
+ # star_plot = gr.Plot(visible=False)
96
+ # issue_plot = gr.Plot(visible=False)
97
 
98
  fetch.click(create_pip_plot, inputs=[libraries, pip], outputs=pip_plot)
99
+ # fetch.click(create_star_plot, inputs=[libraries, pip], outputs=star_plot)
100
+ # fetch.click(create_issue_plot, inputs=[libraries, issues], outputs=issue_plot)
101
 
102
  if __name__ == "__main__":
103
+ demo.launch()