{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 108868 characters]",
      "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 실험 결과\n",
    "bow_c = np.array([85.1, 85.1, 85.1, 85.76, 85.78, 85.84, 85.75, 85.72, 85.58])\n",
    "bow_e = np.array([84.43, 84.43, 84.43, 84.95, 84.88, 85.00, 84.95, 85.00, 84.94])\n",
    "bow_j = np.array([85.36, 85.36, 85.36, 86.10, 86.09, 86.16, 86.10, 85.87, 85.78])\n",
    "\n",
    "tfidf_c = np.array([83.66, 83.66, 83.66, 84.37, 84.37, 84.42, 84.44, 84.38, 84.44])\n",
    "tfidf_e = np.array([83.66, 83.66, 83.66, 84.42, 84.33, 84.46, 84.45, 84.45, 84.46])\n",
    "\n",
    "word2vec_c = np.array([84.43, 84.43, 84.43, 85.03, 85.04, 84.91, 84.93, 84.92, 84.93])\n",
    "word2vec_e = np.array([85.69, 86.04, 85.85, 85.88, 85.84, 85.81, 85.84, 85.86, 85.84])\n",
    "\n",
    "# 그래프 설정\n",
    "plt.figure(figsize=(10, 6))\n",
    "\n",
    "# 글씨 크기 설정\n",
    "plt.rcParams.update({'font.size': 22})\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='KNNTF-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",
    "# 그래프 꾸미기\n",
    "plt.xlabel('K')\n",
    "plt.ylabel('Recall')\n",
    "plt.legend()\n",
    "\n",
    "# 그래프 출력\n",
    "plt.grid(True)\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 63484 characters]",
      "text/plain": [
       "<Figure size 1000x500 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# 데이터\n",
    "C_values = [0.1, 1, 10, 100, 1000, 10000, 100000]\n",
    "BoW_scores = [84.74, 89.12, 89.36, 89.36, 89.36, 89.36, 89.36]\n",
    "TFIDF_scores = [69.54, 88.67, 90.02, 90.02, 89.87, 89.33, 89.18]\n",
    "Word2Vec_scores = [29.1, 51.54, 71.46, 79, 77.62, 87.28, 87.12]\n",
    "\n",
    "# 플로팅\n",
    "plt.figure(figsize=(10, 5))  # 가로 8, 세로 4로 상하 크기를 줄임\n",
    "plt.rcParams.update({'font.size': 22})\n",
    "\n",
    "plt.plot(C_values, BoW_scores, label='SVM BoW', marker='o', color='blue')\n",
    "plt.plot(C_values, TFIDF_scores, label='SVM TF-IDF', marker='s', color='red')\n",
    "plt.plot(C_values, Word2Vec_scores, label='SVM Word2Vec', marker='^', color='green')\n",
    "\n",
    "# 로그 스케일로 C 값 표현\n",
    "plt.xscale('log')\n",
    "\n",
    "# y축 범위 설정\n",
    "plt.ylim(67, 93)\n",
    "\n",
    "# 제목과 레이블\n",
    "\n",
    "plt.xlabel('C')\n",
    "plt.ylabel('Recall')\n",
    "\n",
    "# 범례와 그리드\n",
    "plt.legend()\n",
    "plt.grid(True)\n",
    "\n",
    "# 글자 크기 설정\n",
    "plt.xticks()\n",
    "plt.yticks()\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.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
