202 lines
214 KiB
Plaintext
202 lines
214 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAKyCAYAAAAEvm1SAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy80BEi2AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdeXhM1/8H8PdkmckqESFEJLELsQRRLbUUtW9VS7WxtLSl6Kb11VKxtCilLaWlRdFSFCnKD42lthKx77tISCSRfSbbzO+PdG4zMpPMJHfmZibv1/PkMTP33Hs/M3Imk3fOOVem0Wg0ICIiIiIiIiIisiA7qQsgIiIiIiIiIqKKh6EUERERERERERFZHEMpIiIiIiIiIiKyOIZSRERERERERERkcQyliIiIiIiIiIjI4hhKERERERERERGRxTGUIiIiIiIiIiIii2MoRUREREREREREFsdQioiIiIiIiIiILI6hFBERERERERERWVypQqmEhATs3LkTn332GXr27Alvb2/IZDLIZDKMGjXK5OPt3r0bAwcOhJ+fHxQKBfz8/DBw4EDs3r3b6GPk5eXh+++/x/PPP4+qVavC2dkZdevWxVtvvYVLly6ZXBMREREREREREZmPTKPRaEzeSSYzuG3kyJFYs2aNUcdRq9V488038dNPPxlsM2bMGPzwww+wszOcnyUmJqJXr144deqU3u0KhQJLly7FmDFjjKqLiIiIiIiIiIjMq8zT9/z9/fHiiy+Wat9PP/1UCKRCQkKwYcMGnDx5Ehs2bEBISAgA4Mcff8S0adMMHiM/Px8DBw4UAqmXXnoJu3fvxj///INvv/0W1apVQ3Z2Nt566y2TRl4REREREREREZH5lGqk1IwZMxAaGorQ0FD4+Pjg7t27qF27NgDjR0pdv34dTZo0QV5eHlq3bo3Dhw/D2dlZ2J6VlYWOHTsiKioKDg4OuHLlCurVq1fkOKtWrcIbb7wBABg/fjy+++47ne03b95Eq1atkJaWhnr16uHKlStwcHAw9SkTEREREREREZGISjVSaubMmejTpw98fHxKfeKvv/4aeXl5AIAlS5boBFIA4OLigiVLlgAoWC9q8eLFeo+zcOFCAICXlxcWLFhQZHu9evUwdepUAAUB1bZt20pdMxERERERERERiUOSq+9pNBpEREQAABo1aoS2bdvqbde2bVs0bNgQABAREYGnB3Vdv34dV65cAQAMGTIELi4ueo9TePF1hlJERERERERERNKTJJS6c+cO4uLiAAAdO3Ystq12e2xsLO7evauz7ciRI0Xa6VO9enU0aNAAAHD06NHSlExERERERERERCKSJJS6fPmycLtRo0bFti28XTsqqizHiYmJQWZmptG1EhERERERERGR+CQJpR48eCDc9vPzK7ZtrVq1hNsxMTFlPo5Go9HZj4iIiIiIiIiILE+Sy9Clp6cLt93c3Ipt6+rqKtzOyMgwy3EKy87ORnZ2tnBfrVYjOTkZVapUgUwmK/YcREREREREREQVnUajQXp6Onx9fWFnZ3g8lCShlEqlEm7L5fJi2yoUCuG2Uqk0y3EKmzt3LmbOnFnssYiIiIiIiIiIqHgxMTHFzmyTJJRycnISbufk5BTbtvCoJWdn52KPU/i+KccpbOrUqfjggw+E+6mpqfD390dMTAwqVapUbK1k26KiotC6dWupyyCyCexPROJgXyISD/sTkXjYnygtLQ21atWCu7t7se0kCaUKF1XcVDoAOouSPz1F7+njFBdKFXecwhQKhc6oKq1KlSoxlKrg3Nzc+D1AJBL2JyJxsC8RiYf9iUg87E+kVdIySJIsdF546FZJi44XXty88KLnpT2OTCYrcVF0In2aNm0qdQlENoP9iUgc7EtE4mF/IhIP+xMZS5JQqnHjxsLtq1evFtu28PagoKAyH6dWrVo6i54TGaukqaZEZDz2JyJxsC8RiYf9iUg87E9kLElCqdq1a8PX1xcAcOjQoWLbHj58GABQs2ZNBAYG6mxr3769cLu44zx69AjXr18HALRr1640JRPh2rVrUpdAZDPYn4jEwb5EJB72JyLxsD+RsSQJpWQyGfr37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Hk5CR1GVQGbm5u8PDwwP3795GYmAgfHx+znIcLnRMREREREVVQGo0G6enp8PDwYCBFRDqcnZ1RqVIlpKenmy24ZyhFZCRvb2+pSyCyGexPROJgXyIST0XtT7m5ucjNzYWbm5vUpZANcXDgpCxb4e7uLrxPmANDKSIj1alTR+oSiGwG+xORONiXiMRTUfuT9ip75lovhiomhUIhdQkkEu17g7muyMlQishIFy5ckLoEIpvB/kQkDvYlIvFU9P7ERc1JTFlZWVKXQCIx93sDQykiIymVSqlLILIZ7E9E4mBfIhIP+xOReCryhQPINAyliIiIiIiIiIjI4hhKERmJiz8SiYf9iUgc7EtE4mF/IhKPnR2jBjIOv1OIjNS4cWOpSyCyGexPROJgXyISD/sTkXicnZ2lLoGsBEMpIiPduHFD6hKIbAb7E5E42JeIxMP+RCQelUoldQlkJRhKERnpyZMnUpdAZDPYn4jEwb5EJB72J7KEgwcPQiaTGfxyc3NDgwYNEBYWhsjISIPHuXv3brHH0fc1YMAAg8d78OABwsPD8fzzz6Nq1apwdHSEs7Mz/Pz80KFDB7z77rvYsmULUlNThX06depk8FzOzs5G1bRmzRoRX12yRg5SF0BERERERETW4f79+0hMTJS6DLPw9vaGv7+/pDVkZmbixo0buHHjBtavX48RI0Zg1apVsLe3N9s5V65ciffeew9ZWVk6j+fl5SE2NhaxsbH4+++/8e2332Lo0KHYuHGj2WqhioehFJGRzPmDgKiiYX8iEgf7EpF42J9Kdv/+fQQFBRUJL2yFk5MTrl27ZrFgaty4cRg/frxwX6PRIDk5GcePH8fixYuRkJCAtWvXolatWpgzZ47B4/Tv37/
|
||
|
"text/plain": [
|
||
|
"<Figure size 1200x700 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import matplotlib.patches as mpatches\n",
|
||
|
"\n",
|
||
|
"folds = ['Fold 1', 'Fold 2', 'Fold 3', 'Fold 4', 'Fold 5']\n",
|
||
|
"only_desc = [0.9531471841, 0.9102803738, 0.9613453815, 0.9609895338, 0.8950984883]\n",
|
||
|
"plus_u = [0.9545669664, 0.9166261682, 0.9769076305, 0.9722131304, 0.9098859368]\n",
|
||
|
"plus_u_n = [0.9659252248, 0.9168224299, 0.968875502, 0.9814462417, 0.9180027485]\n",
|
||
|
"plus_u_m_m = [0.9602460956, 0.9182242991, 0.96937751, 0.9724072312, 0.8973889143]\n",
|
||
|
"plus_u_sel_n = [0.9645054425, 0.9168224299, 0.9789156627, 0.973358706, 0.952817224]\n",
|
||
|
"\n",
|
||
|
"data = np.array([only_desc, plus_u, plus_u_n, plus_u_m_m, plus_u_sel_n]) * 100\n",
|
||
|
"max_indices = np.argmax(data, axis=0)\n",
|
||
|
"\n",
|
||
|
"x = np.arange(len(folds))\n",
|
||
|
"width = 0.15\n",
|
||
|
"\n",
|
||
|
"colors = plt.cm.Spectral(np.linspace(0, 1, 5))\n",
|
||
|
"fig, ax = plt.subplots(figsize=(12, 7))\n",
|
||
|
"\n",
|
||
|
"rects1 = ax.bar(x - 2 * width, data[0], width, label='Only Desc.', color=colors[0], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[0] == 0 else '')\n",
|
||
|
"rects2 = ax.bar(x - width, data[1], width, label='+U.', color=colors[1], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[1] == 1 else '')\n",
|
||
|
"rects3 = ax.bar(x, data[2], width, label='+U./N.', color=colors[2], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[2] == 2 else '')\n",
|
||
|
"rects4 = ax.bar(x + width, data[3], width, label='+U./M.M.', color=colors[3], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[3] == 3 else '')\n",
|
||
|
"rects5 = ax.bar(x + 2 * width, data[4], width, label='+U./Sel N.', color=colors[4], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[4] == 4 else '')\n",
|
||
|
"\n",
|
||
|
"for i in range(len(folds)):\n",
|
||
|
" ax.bar(x[i] - 2 * width, data[0][i], width, color=colors[0], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 0 else '')\n",
|
||
|
" ax.bar(x[i] - width, data[1][i], width, color=colors[1], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 1 else '')\n",
|
||
|
" ax.bar(x[i], data[2][i], width, color=colors[2], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 2 else '')\n",
|
||
|
" ax.bar(x[i] + width, data[3][i], width, color=colors[3], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 3 else '')\n",
|
||
|
" ax.bar(x[i] + 2 * width, data[4][i], width, color=colors[4], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 4 else '')\n",
|
||
|
"\n",
|
||
|
"desc_mean = np.mean(only_desc) * 100\n",
|
||
|
"plus_u_mean = np.mean(plus_u) * 100\n",
|
||
|
"plus_u_n_mean = np.mean(plus_u_n) * 100\n",
|
||
|
"plus_u_m_m_mean = np.mean(plus_u_m_m) * 100\n",
|
||
|
"sel_n_mean = np.mean(plus_u_sel_n) * 100\n",
|
||
|
"\n",
|
||
|
"ax.axhline(y=desc_mean, color=colors[0], linestyle='--')\n",
|
||
|
"ax.axhline(y=plus_u_mean, color=colors[1], linestyle='--')\n",
|
||
|
"ax.axhline(y=plus_u_n_mean, color=colors[2], linestyle='--')\n",
|
||
|
"ax.axhline(y=plus_u_m_m_mean, color=colors[3], linestyle='--')\n",
|
||
|
"ax.axhline(y=sel_n_mean, color=colors[4], linestyle='--', label='Sel N. Mean')\n",
|
||
|
"\n",
|
||
|
"ax.text(x[1], sel_n_mean + 0.5, f'Max: {sel_n_mean:.2f}%', ha='center', fontsize=20, color='black')\n",
|
||
|
"ax.set_ylim([88, 100])\n",
|
||
|
"\n",
|
||
|
"ax.set_xticks(x)\n",
|
||
|
"ax.set_xticklabels(folds, fontsize=20)\n",
|
||
|
"\n",
|
||
|
"ax.grid(True, which='both', linestyle='--', linewidth=0.7, alpha=0.7, zorder=1)\n",
|
||
|
"\n",
|
||
|
"ax.tick_params(axis='both', which='major', labelsize=20)\n",
|
||
|
"\n",
|
||
|
"hatch_patch = mpatches.Patch(facecolor='white', edgecolor='black', hatch='//', label='BEST')\n",
|
||
|
"\n",
|
||
|
"legend = ax.legend(handles=[hatch_patch] + ax.get_legend_handles_labels()[0], fontsize=20)\n",
|
||
|
"\n",
|
||
|
"plt.tight_layout()\n",
|
||
|
"plt.show()\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAKyCAYAAAAEvm1SAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy80BEi2AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzde1xT9f8H8Nc2xriDiKLgBRXvoOIt85K31MLUzNKy8JaVppVdzJ9lpek3tZuZpml5yWt5Sc1K01LLuyheULyhgIoIIvfLgLH9/qCdmGxjwzMOG6/n49Gjbed9znlv8h7svc/nc2Q6nU4HIiIiIiIiIiKiSiSXOgEiIiIiIiIiIqp+2JQiIiIiIiIiIqJKx6YUERERERERERFVOjaliIiIiIiIiIio0rEpRURERERERERElY5NKSIiIiIiIiIiqnRsShERERERERERUaVjU4qIiIiIiIiIiCodm1JERERERERERFTp2JQiIiIiIiIiIqJKV6GmVEpKCn799Vd8+OGHePzxx+Hn5weZTAaZTIYxY8ZYfbxdu3Zh6NChqFevHlQqFerVq4ehQ4di165dFh9Do9Hg22+/RY8ePVCrVi24urqiSZMmeOWVV3DhwgWrcyIiIiIiIiIiItuR6XQ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RBVFjaliCxky19ARNUN64lIHKwlIvHYUz3duHEDLVu2LNO8cBRubm64ePFipTWmJk6ciFdffVW4r9PpkJaWhqNHj2LBggVISUnBmjVrUL9+fcy
|
||
|
"text/plain": [
|
||
|
"<Figure size 1200x700 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import matplotlib.patches as mpatches\n",
|
||
|
"\n",
|
||
|
"# Fold 및 실험 데이터\n",
|
||
|
"folds = ['Fold 1', 'Fold 2', 'Fold 3', 'Fold 4', 'Fold 5']\n",
|
||
|
"t5_tiny = [0.9479413157, 0.9028037383, 0.9708835341, 0.9652711703, 0.9496106276]\n",
|
||
|
"t5_mini = [0.957406531, 0.9130841121, 0.9764056225, 0.9686013321, 0.9459459459]\n",
|
||
|
"t5_small = [0.9588263133, 0.9196261682, 0.9748995984, 0.9738344434, 0.9454878607]\n",
|
||
|
"bart_base = [0.9597728348, 0.9126168224, 0.9723895582, 0.9714557564, 0.9601465873]\n",
|
||
|
"t5_base = [0.9645054425, 0.9168224299, 0.9789156627, 0.973358706, 0.952817224]\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"# 데이터 준비\n",
|
||
|
"data = np.array([t5_tiny, t5_mini, t5_small, bart_base, t5_base]) * 100\n",
|
||
|
"max_indices = np.argmax(data, axis=0)\n",
|
||
|
"\n",
|
||
|
"# x축 설정\n",
|
||
|
"x = np.arange(len(folds))\n",
|
||
|
"width = 0.15\n",
|
||
|
"\n",
|
||
|
"# 색상 설정\n",
|
||
|
"colors = plt.cm.Spectral(np.linspace(0, 1, 5))\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(figsize=(12, 7))\n",
|
||
|
"\n",
|
||
|
"# 바 차트 그리기\n",
|
||
|
"rects1 = ax.bar(x - 2 * width, data[0], width, label='T5-Tiny', color=colors[0], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[0] == 0 else '')\n",
|
||
|
"rects2 = ax.bar(x - width, data[1], width, label='T5-Mini', color=colors[1], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[1] == 1 else '')\n",
|
||
|
"rects3 = ax.bar(x, data[2], width, label='T5-Small', color=colors[2], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[2] == 2 else '')\n",
|
||
|
"rects4 = ax.bar(x + width, data[3], width, label='BART-Base', color=colors[3], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[3] == 3 else '')\n",
|
||
|
"rects5 = ax.bar(x + 2 * width, data[4], width, label='T5-Base', color=colors[4], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[4] == 4 else '')\n",
|
||
|
"\n",
|
||
|
"for i in range(len(folds)):\n",
|
||
|
" ax.bar(x[i] - 2 * width, data[0][i], width, color=colors[0], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 0 else '')\n",
|
||
|
" ax.bar(x[i] - width, data[1][i], width, color=colors[1], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 1 else '')\n",
|
||
|
" ax.bar(x[i], data[2][i], width, color=colors[2], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 2 else '')\n",
|
||
|
" ax.bar(x[i] + width, data[3][i], width, color=colors[3], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 3 else '')\n",
|
||
|
" ax.bar(x[i] + 2 * width, data[4][i], width, color=colors[4], edgecolor='black', linewidth=1.5, zorder=3, hatch='//' if max_indices[i] == 4 else '')\n",
|
||
|
"\n",
|
||
|
"# 각 모델의 평균 계산\n",
|
||
|
"t5_tiny_mean = np.mean(t5_tiny) * 100\n",
|
||
|
"t5_mini_mean = np.mean(t5_mini) * 100\n",
|
||
|
"t5_small_mean = np.mean(t5_small) * 100\n",
|
||
|
"bart_base_mean = np.mean(bart_base) * 100\n",
|
||
|
"t5_base_mean = np.mean(t5_base) * 100\n",
|
||
|
"\n",
|
||
|
"# 평균을 점선으로 추가\n",
|
||
|
"ax.axhline(y=t5_tiny_mean, color=colors[0], linestyle='--', label='T5-Tiny Mean')\n",
|
||
|
"ax.axhline(y=t5_mini_mean, color=colors[1], linestyle='--')\n",
|
||
|
"ax.axhline(y=t5_small_mean, color=colors[2], linestyle='--')\n",
|
||
|
"ax.axhline(y=bart_base_mean, color=colors[3], linestyle='--')\n",
|
||
|
"ax.axhline(y=t5_base_mean, color=colors[4], linestyle='--', label='T5-Base Mean')\n",
|
||
|
"\n",
|
||
|
"# 가장 높은 평균값과 가장 낮은 평균값 계산\n",
|
||
|
"max_mean = max(t5_tiny_mean, t5_mini_mean, t5_small_mean, bart_base_mean, t5_base_mean)\n",
|
||
|
"min_mean = min(t5_tiny_mean, t5_mini_mean, t5_small_mean, bart_base_mean, t5_base_mean)\n",
|
||
|
"\n",
|
||
|
"# Fold 2의 중앙 정렬로 Max와 Min 텍스트 추가\n",
|
||
|
"ax.text(x[1], max_mean + 0.5, f'Max: {max_mean:.2f}%', ha='center', fontsize=20, color='black')\n",
|
||
|
"ax.text(x[1], min_mean - 0.8, f'Min: {min_mean:.2f}%', ha='center', fontsize=20, color='black')\n",
|
||
|
"\n",
|
||
|
"# y축 설정\n",
|
||
|
"ax.set_ylim([88, 100])\n",
|
||
|
"\n",
|
||
|
"ax.set_xticks(x)\n",
|
||
|
"ax.set_xticklabels(folds, fontsize=20)\n",
|
||
|
"\n",
|
||
|
"ax.grid(True, which='both', linestyle='--', linewidth=0.7, alpha=0.7, zorder=1)\n",
|
||
|
"\n",
|
||
|
"ax.tick_params(axis='both', which='major', labelsize=20)\n",
|
||
|
"\n",
|
||
|
"hatch_patch = mpatches.Patch(facecolor='white', edgecolor='black', hatch='//', label='BEST')\n",
|
||
|
"legend = ax.legend(handles=[hatch_patch] + ax.get_legend_handles_labels()[0], fontsize=20, loc='upper right')\n",
|
||
|
"\n",
|
||
|
"plt.tight_layout()\n",
|
||
|
"plt.show()\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "torch",
|
||
|
"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.14"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|