172 lines
223 KiB
Plaintext
172 lines
223 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA8YAAAI1CAYAAAAU4OPCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3xTVf8H8M/t3i1QaBktZcsouwzZIkOGDEcFFFAfBZShAo+y9/DB9QNBVERBQQUFZE+pyCzLIpsyWlYLZXSPNLm/Pw43o03aJk3bpP28X6/7apJ77s1JT5vke79nSLIsyyAiIiIiIiIqoxxKugJEREREREREJYmBMREREREREZVpDIyJiIiIiIioTGNgTERERERERGUaA2MiIiIiIiIq0xgYExERERERUZnGwJiIiIiIiIjKNAbGREREREREVKYxMCYiIiIiIqIyzamkK2DvNBoN7ty5A29vb0iSVNLVISIiIiIiIgCyLCM5ORlVqlSBg0PeOWG7C4wPHTqEJUuW4NChQ7h37x58fHwQGhqKYcOGYejQoUaD08ePH+Ovv/7CyZMncerUKZw8eRJxcXEAgO+//x7Dhw+3uD537txBUFCQxccTERERERFR0bl58yaqVauWZxm7CoynTp2KefPmae/7+fkhKSkJ+/fvx/79+/HLL79g06ZNcHV1NThu06ZNeP3114ukTt7e3gDEL9vHx6dInqMwVCoVdu/eje7du8PZ2bmkq1OmsS1sC9vDdrAtbAvbw3awLWwH28K2sD1sh623RVJSEoKCgrQxW17sJjBesWKFNih+5ZVXsGjRIlSrVg1ZWVlYv349Ro0ahZ07d2LMmDH45ptvch0fGBiIZs2aoXnz5mjevDleeOEFq9RLyVD7+PjYbGDs4eEBHx8fm/xjLUvYFraF7WE72Ba2he1hO9gWtoNtYVvYHrbDXtqiIENe7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ouGWlGT6/s2blj3XnDnWq7ebm3WDVWsHrGQeSRJZPkdH0bb26tQpoEUL84/7/Xegfn3xeaLR6H7q387vpzlly8L5y0BvAwbGRERUfIprTKt+htXXV3whB0TwGBVluvtneDjQuLEoe/AgsGCB6Wzbl18Cr74qyu7bB/Tta7o+X36pC4zv3hXdLk2JjdXddnEx/CIiSYYBh6enbl+FCkD//qaDldatdWWrVgXeegv49tt8f5W5DBggzpWcLLIy7drp9mVni6yZsk/ZlPZ0dtaVTU4G/v7b9PO88oouMFapDJ9H4eAgguR+/YDVq3WPv/iieK6cwbaXF1CrlhjLrrh4Ufy+vLzE7ykzU9StoEGtsfvZ2eb/Xi3RoYPoNVDYQNbNTQRQRKVFSIgIjMl6LL1IYUcYGBMRUfGwZEzr5s3AmDEiyNEPTqdOBZo0EeXWrQMmTTIMWvWDyU2bROAEAPv364JZYxo00AXGDx6Ibt2m6HfV8/QUm6nAo0oVXdmQEODDD00HKg0a6MqGhopsorLP1dV0hrRaNWDjRtP11efmJn4nlgTGb74J9O5tfF9AgGE2GRDtnZ4ugk39tXg9PID168XvUT+QVm63aqUrm5EhAlqlTGqqeFyjEUFpZqZo88RE4NEjkS0yJShIBNlKEHvkiPldygtCkkQw7ucH+PiICzTKlvP+w4fA9OnmP8cXX9hW910iIjvGwJiIiIrHvn2WBSBffpn7sWHDdIFxRgZw7ZrxYyVJBE2KgAARSJjKptWpoyvbvLno9msq2xYYqCvbpUvBx7RVrw4sXFiwsi4uujHE1la5cvEcp2S5PTwMH3dzE5ldJXA2ln397jvd/b59dfsfPxYB8OPHIpDevFn8rgri5k3gl18KVtbdXWT6lQB22zbT2eBGjcR5laC
|
||
|
"text/plain": [
|
||
|
"<Figure size 1000x600 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import numpy as np\n",
|
||
|
"\n",
|
||
|
"# k 값\n",
|
||
|
"k_values = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])\n",
|
||
|
"\n",
|
||
|
"# BoW, TF-IDF, Word2Vec, TF-IDF Class 실험 결과\n",
|
||
|
"bow_c = np.array([90.13, 90.31, 90.41, 90.15, 90.11, 90.14, 90.16, 90.16, 90.12])\n",
|
||
|
"bow_e = np.array([86.32, 87.03, 87.61, 87.81, 87.83, 87.85, 88.06, 88.34, 88.42])\n",
|
||
|
"bow_j = np.array([86.58, 87.18, 87.80, 88.01, 88.07, 88.08, 88.21, 88.43, 88.40])\n",
|
||
|
"\n",
|
||
|
"tfidf_c = np.array([89.77, 90.30, 90.52, 90.78, 90.82, 90.77, 90.74, 90.70, 90.70])\n",
|
||
|
"tfidf_e = np.array([89.80, 90.23, 90.42, 90.64, 90.75, 90.81, 90.85, 90.83, 90.82])\n",
|
||
|
"\n",
|
||
|
"word2vec_c = np.array([88.44, 88.40, 88.16, 87.24, 86.83, 86.99, 86.51, 86.51, 86.28])\n",
|
||
|
"word2vec_e = np.array([87.47, 87.89, 88.03, 87.77, 87.71, 87.66, 87.57, 87.36, 87.26])\n",
|
||
|
"\n",
|
||
|
"tfidf_class_c = np.array([90.12, 90.12, 90.12, 90.12, 90.12, 90.12, 90.12, 90.12, 90.12])\n",
|
||
|
"\n",
|
||
|
"# 그래프 설정\n",
|
||
|
"plt.figure(figsize=(10, 6))\n",
|
||
|
"\n",
|
||
|
"# 글씨 크기 설정 (1단계 낮춤)\n",
|
||
|
"plt.rcParams.update({'font.size': 18})\n",
|
||
|
"\n",
|
||
|
"# 도형 크기를 1.5배로 설정\n",
|
||
|
"marker_size = 9 # 기본 크기가 6이므로 1.5배로 설정\n",
|
||
|
"\n",
|
||
|
"# BoW (C, E, J) -> 색상: 파란색, 도형: 원(circle), 사각형(square), 삼각형(triangle_up)\n",
|
||
|
"plt.plot(k_values, bow_c, 'bo--', label='KNN BoW C', markersize=marker_size) # C: 점선\n",
|
||
|
"plt.plot(k_values, bow_e, 'bs-', label='KNN BoW E', markersize=marker_size)\n",
|
||
|
"plt.plot(k_values, bow_j, 'b^-', label='KNN BoW J', markersize=marker_size)\n",
|
||
|
"\n",
|
||
|
"# TF-IDF (C, E) -> 색상: 빨간색, 도형: 원(circle), 사각형(square)\n",
|
||
|
"plt.plot(k_values, tfidf_c, 'ro--', label='KNN TF-IDF C', markersize=marker_size) # C: 점선\n",
|
||
|
"plt.plot(k_values, tfidf_e, 'rs-', label='KNN TF-IDF E', markersize=marker_size)\n",
|
||
|
"\n",
|
||
|
"# Word2Vec (C, E) -> 색상: 녹색, 실선, 도형: 원(circle), 사각형(square)\n",
|
||
|
"plt.plot(k_values, word2vec_c, 'go--', label='KNN Word2Vec C', markersize=marker_size) # C: 점선\n",
|
||
|
"plt.plot(k_values, word2vec_e, 'gs-', label='KNN Word2Vec E', markersize=marker_size) # 실선\n",
|
||
|
"\n",
|
||
|
"# TF-IDF Class (C) -> 색상: 보라색, 실선, 도형: 원(circle)\n",
|
||
|
"plt.plot(k_values, tfidf_class_c, 'mo-', label='KNN TF-IDF Class C', markersize=marker_size)\n",
|
||
|
"\n",
|
||
|
"# 그래프 꾸미기\n",
|
||
|
"plt.xlabel('K')\n",
|
||
|
"plt.ylabel('Recall')\n",
|
||
|
"\n",
|
||
|
"# 범례를 우측 하단에 위치시킴\n",
|
||
|
"plt.legend(loc='lower right')\n",
|
||
|
"\n",
|
||
|
"# 그래프 출력\n",
|
||
|
"plt.grid(True)\n",
|
||
|
"plt.tight_layout()\n",
|
||
|
"plt.show()\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABIgAAAKUCAYAAABv6AMZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd1wT5x8H8E8IezpQUFTE4gKtUledSFXce1SrdVSldbS11da6raPWWqtWa391a6271F23uBUXdeAWhAIiKigICCT3++OaI4EkBARC4PN+vfIiyT1391wuJN987xkyQRAEEBERERERERFRiWVm7AoQEREREREREZFxMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERFTCMUFERERERERERIUqNTUVy5cvR5s2bVCuXDlYWlrCzc0NnTt3xtatW/Wuq1QqERoainXr1mH06NFo1KgRrKysIJPJIJPJEBQUlG/1vHPnDhYtWoQePXrAw8MDNjY2sLW1hYeHB95//33s27cPgiDk2/6MSSaY+JEcPnwYK1euxIULFxAbGwuZTIYKFSqgadOmCAgIgK+vr851Y2Nj8cMPP2Dv3r2IiIiAjY0NvL29MWTIEAwfPhwymawQj4SIiIiIiIio+Ltz5w66d++OO3fu6CzToUMH7NixA3Z2dtmWrV+/HkOHDtW57vHjx9G6des3rueQIUOwYcOGHMu1b98eW7ZsQalSpd54n8Zksi2IBEHAJ598An9/f2zfvh0RERFStjAsLAybNm1C69at8eWXX2pd//Lly/D29sZPP/2Eu3fvwtzcHImJiTh9+jRGjhyJDh064PXr14V8VERERERERETFV1xcHNq1ayclh/r27Yu9e/fiypUr2Lt3L/r27QsAOHDgAAYMGKB1G+rtXCwsLODj44O6devme12joqIAAGXKlEFAQAA2bdqEs2fPIjg4GL/99htq1qwJADh48CC6du0KpVKZ73UoTCabIFq3bh1+++03AECfPn1w9+5dpKSkIDk5Gbdv30b37t0BAIsWLcJff/2lse6LFy/QpUsXPHv2DLVq1cLFixeRmJiIV69eYdmyZbCwsMChQ4fwxRdfFPpxERERERERERVX3377LSIjIwEAM2bMwLZt29C5c2f4+Pigc+fO2LZtG6ZPnw4A2LNnDwIDA7Ntw8vLC0uWLMG5c+fw8uVLXLlyBb169cr3ulaqVAm//fYboqOj8dtvv2HAgAFo2rQpGjVqhICAAFy5cgUtWrQAAJw+fRp//PFHvtehMJlsFzM/Pz8EBQXB09MTt27dgrm5ucby9PR01KpVCw8fPkT//v2xefNmadm0adMwZ84c2NjY4ObNm/Dw8NBYd968eZg8eTLkcjlCQ0NRo0aNQjkmIiIiIiIiouJKoVDA2dkZCQkJcHd3x4MHDyCXy7WWq1atGiIiItCwYUNcvHgxx23PnDkT3377LYD862JmiBs3bkitl7p164Zdu3YVyn4Lgsm2IIqJiQEA1KtXL1tyCBCbmdWvXx8AkJSUpLFM1Yewf//+2ZJDAPDpp5/C3t4eCoXC5DOAREREREREREXBvXv3kJCQAABo166d1uQQAMjlcrRr1w4AcOnSJYSHhxdSDXOvTp06cHZ2BgA8ePDAyLV5MyabIKpWrRoA4J9//kFGRka25enp6QgJCQEANGzYUHr+zp07iIiIAAB07NhR67bt7e3RsmVLAMChQ4fys9pEREREREREJdLz58+l+y4uLnrLqi8/efJkgdUpP6SlpQEAzMxMNsUCwIQTRKNGjQIA3L9/HwMGDMD9+/elZXfu3EG/fv3w8OFDvPXWWxpjCd24cUO6X6dOHZ3bVy0LDQ3N76oTERERERERlTjqM5K9ePFCb1n15UX5d/nVq1fx8uVLAECtWrWMXJs3Y7IJoq5du2LRokWwtLTEjh07UL16ddja2sLW1ha1atVCUFAQRo0aheDgYDg6OkrrRUdHS/fd3Nx0bl+17OXLl9m6qBERERERERFR7nh6esLCwgJAzq2C1JeregEVRd999510v1+/fkasyZvLPniPCRk3bhyqV6+Ojz76CE+ePEFKSoq07PXr10hMTMSLFy9QpkwZ6fnExETpvq2trc5tqy9LTEyEvb291nKvX7/G69evpccZGRm4desWKleubPLNy4iIiIiIiIh0USqViIiIgJeXl8bYwFZWVrCysspW3s7ODm3atMGBAwdw7do1bN68WetU9ps3b8b169elx+q/44uSP//8Ezt27AAANGjQAL179zZyjd6QYKJevXol9OvXTwAgNGzYUDh06JDw9OlTIS4uTjh06JDQsGFDAYDg7Ows/PPPP9J6c+fOFQAIAIT09HSd21+xYoVULjo6Wme5GTNmSOV444033njjjTfeeOONN954462k32bMmKHzN/SFCxcEc3NzAYBgYWEhzJ49W3j06JGQlpYmPHr0SJg9e7ZgYWEhWFpaSttr06ZNjjkC9d/mx48fz7H8m7p165bg4OAgABBsbGyEmzdvFvg+C5rJtiD66quvsG3bNtSoUQMnT56EjY2NtKxdu3Zo0aIF6tevj7t372LMmDE4deoUAMDBwUEql5ycrNH9TF1ycrJ0X32drCZNmoQvv/xSehwZGYk6derg7NmzqFChQp6Pj/JXeno6Tp48iVatWklNGsl08XwWPzynxQvPZ/HC81n88JwWLzyfxYupnc+YmBg0a9YMN27cQOXKlaXntbUeUmncuDFWr16NkSNHIi0tDdOmTcO0adM0ysjlcixevBiffvopAP2/yY0hOjoaHTt2RGJiImQyGVavXg0vLy9jV+uNmWSCKDExEStWrAAAjB07ViM5pGJjY4OxY8fis88+w+nTp/HkyROUL18eFStWlMpERUXpTBBFRUUBABwdHXV2LwOyN51zcnICAFSuXBmVKlXK/cFRgUhPT0doaCiqVq1qEh+0pB/PZ/HDc1q88HwWLzyfxQ/PafHC81m8mNr5VHUrc3Jy0vnbWpvBgwejXr16mDt3Lg4cOCB1ITMzM4Ofnx/mzp2rMaB16dKl87fib+D58+fw9/dHeHg4AGDJkiVau8mZIpNMEN29e1ea2v6tt97SWa569erS/bCwMJQvX15j5rIbN26gdu3aWtdVzXZWHLKAREREREREREVJvXr1sG3bNigUCsTExCA1NRUVK1aUxgPetGmTVLao/C5PTExEhw4dcPPmTQDA7NmzpVZOxYFJjqKsPvjzo0ePdJaLjY2V7quapNWsWRNVqlQBABw4cEDreq9evZK6pPn7+79xfYmIiIiIiIgoO7lcjkqVKsHT01NjsqjTp09L95s0aWKMqmlISUlB165dcfHiRQDisDdTp041cq3yl0kmiGrVqiV1K1u1apXUmkidQqGQuqGVLl0aNWvWlJYNHjwYALBlyxapWZi6X375BUlJSZDL5Rg4cGABHAERERERERERaZOWlibNDubm5oZmzZoZtT7p6eno3bs3Tpw4AQD45JNP8MMPPxi1TgXBJBNENjY2GDFiBADgypUr6Nq1K65fvw6lUgmlUolr166hU6dOOHv2LABg3LhxkMvl0voTJkyAq6srkpOT0blzZ1y+fBmA+Cb89ddfpQGyAgICUKNGjUI+OiIiIiIiIqKSa8mSJYiLiwMgJmPUf88XNoVCgQ8++AB///03AODDDz/E8uXLjVafgmSSCSIAmD9/Pjp06ABA7Cr29ttvw9bWFra2tqhXrx4OHToEABgwYACmTJmisa6TkxP27t2LsmXLIjQ0FA0bNpQGox49ejTS0tLg7++PRYsWFfpxERERERERERVnEREROpft2bNH+g1fvXp1TJgwocDq0bp1a8hkMshkMq29iwRBwMiRI6XWTL1798batWshk8kKrE7GZJKDVANiK6L9+/fjzz//xMaNG3H58mU8efIEMpkMlStXRuPGjTFs2DB07txZ6/oNGjT
|
||
|
"text/plain": [
|
||
|
"<Figure size 1200x700 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import pandas as pd\n",
|
||
|
"\n",
|
||
|
"# 데이터 정의\n",
|
||
|
"data = {\n",
|
||
|
" 'THsim': [0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0],\n",
|
||
|
" 'DistilBERT_Precision': [0.7144, 0.7153, 0.7159, 0.7164, 0.7168, 0.7174, 0.7181, 0.7189, 0.7202, 0.7208, 0.7217, 0.7225, 0.7235, 0.7245, 0.7258, 0.7277],\n",
|
||
|
" 'DistilBERT_Recall': [0.9101, 0.9102, 0.9102, 0.9103, 0.9104, 0.9105, 0.9106, 0.9105, 0.9105, 0.9105, 0.9105, 0.9102, 0.9104, 0.9104, 0.9102, 0.9086],\n",
|
||
|
" 'TF-IDF_Precision': [0.7240, 0.7245, 0.7245, 0.7245, 0.7247, 0.7248, 0.7247, 0.7254, 0.7259, 0.7264, 0.7265, 0.7266, 0.7268, 0.7268, 0.7268, 0.7268],\n",
|
||
|
" 'TF-IDF_Recall': [0.9093, 0.9096, 0.9095, 0.9095, 0.9091, 0.9091, 0.9090, 0.9093, 0.9094, 0.9094, 0.9094, 0.9092, 0.9089, 0.9089, 0.9086, 0.9086],\n",
|
||
|
" 'No_Refine_Precision': [0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277, 0.7277],\n",
|
||
|
" 'No_Refine_Recall': [0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086, 0.9086]\n",
|
||
|
"}\n",
|
||
|
"\n",
|
||
|
"# 데이터프레임으로 변환\n",
|
||
|
"df = pd.DataFrame(data)\n",
|
||
|
"\n",
|
||
|
"# 기본 figure 설정\n",
|
||
|
"fig, ax1 = plt.subplots(figsize=(12, 7))\n",
|
||
|
"\n",
|
||
|
"# 폰트 크기 설정 (모두 18로 설정)\n",
|
||
|
"plt.rcParams.update({'font.size': 20})\n",
|
||
|
"\n",
|
||
|
"# 첫 번째 y축 (왼쪽) - Precision\n",
|
||
|
"ax1.set_xlabel(r'TH$_{sim}$', fontsize=20, color='black')\n",
|
||
|
"ax1.set_ylabel('Precision', fontsize=20, color='black')\n",
|
||
|
"ax1.plot(df['THsim'], [x * 100 for x in df['DistilBERT_Precision']], label='DistilBERT Precision', marker='o', linestyle='-', color='blue')\n",
|
||
|
"ax1.plot(df['THsim'], [x * 100 for x in df['TF-IDF_Precision']], label='TF-IDF Precision', marker='x', linestyle='-', color='red')\n",
|
||
|
"ax1.plot(df['THsim'], [x * 100 for x in df['No_Refine_Precision']], label='No Refine Precision', marker='s', linestyle='-', color='green')\n",
|
||
|
"ax1.tick_params(axis='y', labelcolor='black')\n",
|
||
|
"ax1.set_ylim([70, 80]) # y축 범위를 적절하게 설정\n",
|
||
|
"\n",
|
||
|
"# 두 번째 y축 (오른쪽) - Recall\n",
|
||
|
"ax2 = ax1.twinx()\n",
|
||
|
"ax2.set_ylabel('Recall', fontsize=20, color='black')\n",
|
||
|
"ax2.plot(df['THsim'], [x * 100 for x in df['DistilBERT_Recall']], label='DistilBERT Recall', marker='o', linestyle='--', color='blue')\n",
|
||
|
"ax2.plot(df['THsim'], [x * 100 for x in df['TF-IDF_Recall']], label='TF-IDF Recall', marker='x', linestyle='--', color='red')\n",
|
||
|
"ax2.plot(df['THsim'], [x * 100 for x in df['No_Refine_Recall']], label='No Refine Recall', marker='s', linestyle='--', color='green')\n",
|
||
|
"ax2.tick_params(axis='y', labelcolor='black')\n",
|
||
|
"ax2.set_ylim([90.6, 91.2]) # y축 범위를 적절하게 설정\n",
|
||
|
"\n",
|
||
|
"# 제목과 레전드 설정\n",
|
||
|
"ax1.legend(loc='upper left')\n",
|
||
|
"ax2.legend(loc='upper right')\n",
|
||
|
"\n",
|
||
|
"# 왼쪽 y축에 맞춘 그리드 설정\n",
|
||
|
"ax1.grid(True)\n",
|
||
|
"\n",
|
||
|
"# 레이아웃 조정 및 그리드 설정\n",
|
||
|
"plt.tight_layout()\n",
|
||
|
"\n",
|
||
|
"# 그래프 출력\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.9.13"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|