ultima versao
Browse files- __pycache__/helpers.cpython-310.pyc +0 -0
- app.py +89 -0
- requirements.txt +2 -0
__pycache__/helpers.cpython-310.pyc
ADDED
Binary file (4.81 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import plotly.express as px
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
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:
|
30 |
+
ax2.bar(df["Model"].iloc[[1]], df["MAE"].iloc[[1]])
|
31 |
+
if "NEOSP-SVR Regressor" and "NEOSP-SVR Regressor" in pip_choices:
|
32 |
+
ax2.bar(df["Model"], df["MAE"])
|
33 |
+
if "Median Regressor" or "NEOSP-SVR Regressor" in 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()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
plotly
|
2 |
+
helpers
|