File size: 4,763 Bytes
a51c8fe |
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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import csv\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"def gerar_metricas(nome_projeto):\n",
" list_output_MbR = []\n",
" with open(\"metricas/metricas_{}_MbR.csv\".format(nome_projeto), \"r\") as arquivo:\n",
" arquivo_csv = csv.reader(arquivo)\n",
" for i, linha in enumerate(arquivo_csv):\n",
" list_output_MbR.append(float(linha[0]))\n",
" list_output_NEOSP_SVR = []\n",
" with open(\"metricas/metricas_{}_NEOSP_SVR.csv\".format(nome_projeto), \"r\") as arquivo:\n",
" arquivo_csv = csv.reader(arquivo)\n",
" for i, linha in enumerate(arquivo_csv):\n",
" list_output_NEOSP_SVR.append(float(linha[0]))\n",
" list_output_TFIDF_SVR = []\n",
" with open(\"metricas/metricas_{}_TFIDF.csv\".format(nome_projeto), \"r\") as arquivo:\n",
" arquivo_csv = csv.reader(arquivo)\n",
" for i, linha in enumerate(arquivo_csv):\n",
" list_output_TFIDF_SVR.append(float(linha[0]))\n",
" \n",
" list_results = [[\"MbR Regressor\", np.mean(list_output_MbR)], [\"NEOSP-SVR Regressor\", np.mean(list_output_NEOSP_SVR)], [\"TFIDF-SVR Regressor\", np.mean(list_output_TFIDF_SVR)]]\n",
" \n",
" df = pd.DataFrame(list_results, columns=[\"Model\", \"MAE\"])\n",
" \n",
" df_list_output_MbR = pd.DataFrame(list_output_MbR, columns=[\"MAE_MbR\"])\n",
" df_list_output_NEOSP = pd.DataFrame(list_output_NEOSP_SVR, columns=[\"MAE_NEOSP\"])\n",
" df_list_output_TFIDF = pd.DataFrame(list_output_TFIDF_SVR, columns=[\"MAE_TFIDF\"])\n",
" \n",
" return df_list_output_MbR, df_list_output_NEOSP, df_list_output_TFIDF"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"#LIBRARIES_TAWOS = [\"ALOY\", \"APSTUD\", \"CLI\", \"CLOV\", \"COMPASS\", \"CONFCLOUD\", \"CONFSERVER\", \"DAEMON\", \"DM\", \"DNN\", \"DURACLOUD\", \"EVG\", \"FAB\", \n",
"# \"MDL\", \"MESOS\" ,\"MULE\", \"NEXUS\", \"SERVER\", \"STL\", \"TIDOC\", \"TIMOB\", \"TISTUD\", \"XD\"]\n",
"\n",
"LIBRARIES_NEO = [\"7764\", \n",
" \"250833\", \n",
" #\"278964\"\n",
" \"734943\", \n",
" #\"1304532\",\n",
" #\"1714548\", \n",
" \"2009901\",\n",
" \"2670515\", \n",
" \"3828396\",\n",
" \"3836952\", \n",
" \"4456656\", \n",
" \"5261717\",\n",
" \"6206924\", \n",
" \"7071551\", \n",
" \"7128869\",\n",
" \"7603319\",\n",
" \"7776928\", \n",
" \"10152778\",\n",
" \"10171263\", \n",
" \"10171270\", \n",
" \"10171280\",\n",
" \"10174980\", \n",
" \"12450835\",\n",
" \"12584701\",\n",
" \"12894267\",\n",
" \"14052249\",\n",
" \"14976868\", \n",
" \"15502567\",\n",
" \"19921167\", \n",
" \"21149814\", \n",
" \"23285197\", \n",
" \"28419588\",\n",
" \"28644964\", \n",
" \"28847821\"\n",
" ]\n",
"#RETIRADOS = [] Muito grande\n",
"#RETIRADO2 = [] valores NaN\n",
"lista = list()\n",
"for project_name in LIBRARIES_NEO:\n",
" df_list_output_MbR, df_list_output_NEOSP, df_list_output_TFIDF = gerar_metricas(project_name)\n",
" lista.append([project_name, df_list_output_MbR[\"MAE_MbR\"].mean(), df_list_output_NEOSP[\"MAE_NEOSP\"].mean(), df_list_output_TFIDF[\"MAE_TFIDF\"].mean()])\n",
"\n",
"df_media = pd.DataFrame(lista, columns=[\"Projeto\", \"MAE_MbR\", \"MAE_NEOSP\", \"MAE_TFIDF\"])\n",
"df_media.to_csv(\"_METRICAS_NEO.csv\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
|