File size: 9,174 Bytes
5a8a0ea b4a6b00 5a8a0ea b4a6b00 a4839f9 5a8a0ea 95834fd 5a8a0ea 95834fd a4839f9 8694ab2 5a8a0ea 95834fd a4839f9 8694ab2 5a8a0ea 95834fd a4839f9 8694ab2 5a8a0ea 8694ab2 95834fd 5a8a0ea a4839f9 5a8a0ea a4839f9 5a8a0ea 8694ab2 5a8a0ea a4839f9 5a8a0ea 8694ab2 a4839f9 5a8a0ea a4839f9 5a8a0ea a4839f9 9faf1b7 a4839f9 9faf1b7 5a8a0ea a4839f9 5a8a0ea a4839f9 95834fd a4839f9 5a8a0ea a4839f9 5a8a0ea a4839f9 5a8a0ea 9faf1b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
import gradio as gr
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
LIBRARIES = ["ALOY", "APSTUD", "CLI", "TIMOB", "XD"]
def grafico(list_output_mean, list_output_neosp, nome_projeto, pip_choices):
list_results = [["MbR Regressor", np.mean(list_output_mean)], [
"NEOSP-SVR Regressor", np.mean(list_output_neosp)]]
fig, (ax1, ax2) = plt.subplots(1, 2)
# ax1
if "MbR Regressor" in pip_choices:
df_list_output_mean = pd.DataFrame(list_output_mean, columns=["MAE"])
ax1.plot(df_list_output_mean.index,
df_list_output_mean["MAE"], label="MbR Regressor", color="red")
ax1.set
if "NEOSP-SVR Regressor" in pip_choices:
df_list_output_NEOSP = pd.DataFrame(list_output_neosp, columns=["MAE"])
ax1.plot(df_list_output_NEOSP.index,
df_list_output_NEOSP["MAE"], label="NEOSP-SVR Regressor", color="blue")
ax1.set_xlabel("Index Execução")
ax1.set_ylabel("MAE")
ax1.legend()
# ax2
if "MbR Regressor" or "NEOSP-SVR Regressor" in pip_choices:
df = pd.DataFrame(list_results, columns=["Model", "MAE"])
if "NEOSP-SVR Regressor" and "NEOSP-SVR Regressor" in pip_choices:
ax2.bar(df["Model"], df["MAE"], color=["red", "blue"])
elif "MbR Regressor" in pip_choices:
ax2.bar(df["Model"].iloc[[0]], df["MAE"].iloc[[0]], color="red")
elif "NEOSP-SVR Regressor" in pip_choices:
ax2.bar(df["Model"].iloc[[1]], df["MAE"].iloc[[1]], color = "blue")
if "MbR Regressor" or "NEOSP-SVR Regressor" in pip_choices:
ax2.set_ylabel("MAE Médio")
ax2.set_xlabel("Modelos")
# graficos geral
fig.set_figwidth(15)
fig.set_figheight(4)
fig.suptitle("Projeto {}".format(nome_projeto))
return gr.update(value=plt, visible=True)
def create_pip_plot(libraries, pip_choices):
if "ALOY" in libraries:
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]
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]
return grafico(list_output_ALOY_mean, list_output_ALOY_NEOSP, "ALOY", pip_choices)
elif "APSTUD" in libraries:
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]
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]
return grafico(list_output_APSTUD_mean, list_output_APSTUD_NEOSP, "APSTUD", pip_choices)
elif "CLI" in libraries:
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, 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]
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, 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]
return grafico(list_output_CLI_mean, list_output_CLI_NEOSP, "CLI", pip_choices)
elif "TIMOB" in libraries:
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]
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]
return grafico(list_output_TIMOB_mean, list_output_TIMOB_NEOSP, "TIMOB", pip_choices)
elif "XD" in libraries:
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]
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]
return grafico(list_output_XD_mean, list_output_XD_NEOSP, "XD", pip_choices)
else:
return gr.update(visible=True)
demo = gr.Blocks()
with demo:
with gr.Row():
with gr.Column():
gr.Markdown("## Conjunto de Dados")
libraries = gr.Dropdown(
choices=LIBRARIES, label="Projeto", value="ALOY")
with gr.Column():
gr.Markdown("## Gráficos")
pip = gr.CheckboxGroup(
choices=["MbR Regressor", "NEOSP-SVR Regressor"], label="Modelos Preditivos")
# stars = gr.CheckboxGroup(choices=["Stars", "Week over Week"], label="")
# issues = gr.CheckboxGroup(choices=["Issue", "Exclude org members", "week over week"], label="")
with gr.Row():
fetch = gr.Button(value="Fetch")
with gr.Row():
with gr.Column():
pip_plot = gr.Plot(visible=False)
# star_plot = gr.Plot(visible=False)
# issue_plot = gr.Plot(visible=False)
fetch.click(create_pip_plot, inputs=[libraries, pip], outputs=pip_plot)
# fetch.click(create_star_plot, inputs=[libraries, pip], outputs=star_plot)
# fetch.click(create_issue_plot, inputs=[libraries, issues], outputs=issue_plot)
demo.launch() |