{ "cells": [ { "cell_type": "code", "execution_count": 612, "id": "0c24055a-254f-490c-86d6-5550de080558", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "from konlpy.tag import Okt\n", "from tensorflow.keras.preprocessing.text import Tokenizer\n", "from tensorflow.keras.preprocessing.sequence import pad_sequences\n", "from keras.utils.np_utils import to_categorical\n", "from keras.models import Sequential\n", "from keras.layers import Embedding, Bidirectional, LSTM, Dense\n", "from keras.callbacks import EarlyStopping, ModelCheckpoint\n", "from sklearn.metrics import f1_score\n", "from sklearn.preprocessing import LabelEncoder\n", "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from sklearn.model_selection import train_test_split\n", "import re\n", "import urllib.request\n", "from konlpy.tag import Komoran\n", "from tqdm import tqdm\n", "from tensorflow.keras.preprocessing.text import Tokenizer\n", "from tensorflow.keras.preprocessing.sequence import pad_sequences\n", "from tensorflow.keras.models import load_model\n", "from sklearn.utils.class_weight import compute_class_weight" ] }, { "cell_type": "code", "execution_count": 613, "id": "1db4b670-2790-4643-ba4c-a4a39630a176", "metadata": {}, "outputs": [], "source": [ "train_data = pd.read_csv(\"test.csv\",encoding='CP949')" ] }, { "cell_type": "code", "execution_count": 614, "id": "cc02a8ea-09e4-422f-86d0-4b0654d55f04", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
KEYWORD_CDCONTENTLABELDATE
0필링기제품은 이도 저도 아닌 딱 보통02022.03.03
1필링기이도저도 아닌 딱 보통02022.03.03
2필링기그냥 씁니다.02022.03.03
3필링기그냥 사용합시다02022.03.03
4필링기보통이에요02022.03.03
...............
100필링기쓰레기 제품입니다.-12022.03.05
101필링기좋아요좋아요12022.03.05
102필링기별롱비니다-12022.03.05
103필링기쓰레기 제품-12022.03.05
104필링기이제품은 쓰레기-12022.03.05
\n", "

105 rows × 4 columns

\n", "
" ], "text/plain": [ " KEYWORD_CD CONTENT LABEL DATE\n", "0 필링기 제품은 이도 저도 아닌 딱 보통 0 2022.03.03\n", "1 필링기 이도저도 아닌 딱 보통 0 2022.03.03\n", "2 필링기 그냥 씁니다. 0 2022.03.03\n", "3 필링기 그냥 사용합시다 0 2022.03.03\n", "4 필링기 보통이에요 0 2022.03.03\n", ".. ... ... ... ...\n", "100 필링기 쓰레기 제품입니다. -1 2022.03.05\n", "101 필링기 좋아요좋아요 1 2022.03.05\n", "102 필링기 별롱비니다 -1 2022.03.05\n", "103 필링기 쓰레기 제품 -1 2022.03.05\n", "104 필링기 이제품은 쓰레기 -1 2022.03.05\n", "\n", "[105 rows x 4 columns]" ] }, "execution_count": 614, "metadata": {}, "output_type": "execute_result" } ], "source": [ "train_data" ] }, { "cell_type": "code", "execution_count": 615, "id": "134d1ca8-fedc-4739-a3d5-934a141f6980", "metadata": {}, "outputs": [], "source": [ "test_data = pd.read_csv(\"testtest.csv\" ,encoding='CP949')" ] }, { "cell_type": "code", "execution_count": 616, "id": "a18b453b-4654-4496-9560-47435e0e3058", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
KEYWORD_CDCONTENTLABELDATE
0필링기제품은 이도 저도 아닌 딱 보통02022.03.03
1필링기이도저도 아닌 딱 보통02022.03.03
2필링기그냥 씁니다.02022.03.03
3필링기그냥 사용합시다02022.03.03
4필링기보통이에요02022.03.03
5필링기긍정입니다12022.03.03
6필링기절대 안사용함-12022.03.03
7필링기좋아요12022.03.03
8필링기제품 좋아요12022.03.03
9필링기긍정 긍정 긍정 합니다12022.03.03
10필링기딱 보통02022.03.03
11필링기다시는 구매안함-12022.03.03
12필링기절대적으로 안사용함-12022.03.03
13필링기보통이에요02022.03.03
14필링기보통이에요02022.03.03
15필링기보통이에요02022.03.03
16필링기많이 달지않코 식어도 계속 빠삭해요..12022.03.01
17필링기너무 맛있어요 !! 이제 붕세권따윈 의미가 없네요 너무 빠삭하고 맛있어요 !!12022.03.01
18필링기먹고싶을 때마다 에어프라이어에 구워 먹으니 맛나요.12022.03.01
19필링기에어프라이기 180도 10분 돌렸는데 빠삭빠삭 맛있어요????12022.03.01
20필링기진짜 맛있어요 팥도 많이 달지않고 가득들고 피?는얇아요 에어프라이어 돌리면 파는거보...02022.03.02
21필링기다조은데 아주약간짭아요 ㅋㅋ02022.03.03
22필링기시중에서 파는 맛과 90%정도 일치해요02022.03.04
23필링기오븐해서 먹으니 파는 붕어빵보다 맛나요.12022.03.05
24필링기쓸만하고 좋아요12022.03.05
25필링기긍정12022.03.05
26필링기좋고 긍정입니다12022.03.05
27필링기좋은데 좋아요12022.03.05
28필링기재구매 의사 확실히 있음12022.03.05
29필링기그냥 저럭02022.03.05
30필링기쓰레기 제품입니다.-12022.03.05
31필링기좋아요좋아요12022.03.05
32필링기별롱비니다-12022.03.05
33필링기쓰레기 제품-12022.03.05
34필링기이제품은 쓰레기-12022.03.05
\n", "
" ], "text/plain": [ " KEYWORD_CD CONTENT LABEL \n", "0 필링기 제품은 이도 저도 아닌 딱 보통 0 \\\n", "1 필링기 이도저도 아닌 딱 보통 0 \n", "2 필링기 그냥 씁니다. 0 \n", "3 필링기 그냥 사용합시다 0 \n", "4 필링기 보통이에요 0 \n", "5 필링기 긍정입니다 1 \n", "6 필링기 절대 안사용함 -1 \n", "7 필링기 좋아요 1 \n", "8 필링기 제품 좋아요 1 \n", "9 필링기 긍정 긍정 긍정 합니다 1 \n", "10 필링기 딱 보통 0 \n", "11 필링기 다시는 구매안함 -1 \n", "12 필링기 절대적으로 안사용함 -1 \n", "13 필링기 보통이에요 0 \n", "14 필링기 보통이에요 0 \n", "15 필링기 보통이에요 0 \n", "16 필링기 많이 달지않코 식어도 계속 빠삭해요.. 1 \n", "17 필링기 너무 맛있어요 !! 이제 붕세권따윈 의미가 없네요 너무 빠삭하고 맛있어요 !! 1 \n", "18 필링기 먹고싶을 때마다 에어프라이어에 구워 먹으니 맛나요. 1 \n", "19 필링기 에어프라이기 180도 10분 돌렸는데 빠삭빠삭 맛있어요???? 1 \n", "20 필링기 진짜 맛있어요 팥도 많이 달지않고 가득들고 피?는얇아요 에어프라이어 돌리면 파는거보... 0 \n", "21 필링기 다조은데 아주약간짭아요 ㅋㅋ 0 \n", "22 필링기 시중에서 파는 맛과 90%정도 일치해요 0 \n", "23 필링기 오븐해서 먹으니 파는 붕어빵보다 맛나요. 1 \n", "24 필링기 쓸만하고 좋아요 1 \n", "25 필링기 긍정 1 \n", "26 필링기 좋고 긍정입니다 1 \n", "27 필링기 좋은데 좋아요 1 \n", "28 필링기 재구매 의사 확실히 있음 1 \n", "29 필링기 그냥 저럭 0 \n", "30 필링기 쓰레기 제품입니다. -1 \n", "31 필링기 좋아요좋아요 1 \n", "32 필링기 별롱비니다 -1 \n", "33 필링기 쓰레기 제품 -1 \n", "34 필링기 이제품은 쓰레기 -1 \n", "\n", " DATE \n", "0 2022.03.03 \n", "1 2022.03.03 \n", "2 2022.03.03 \n", "3 2022.03.03 \n", "4 2022.03.03 \n", "5 2022.03.03 \n", "6 2022.03.03 \n", "7 2022.03.03 \n", "8 2022.03.03 \n", "9 2022.03.03 \n", "10 2022.03.03 \n", "11 2022.03.03 \n", "12 2022.03.03 \n", "13 2022.03.03 \n", "14 2022.03.03 \n", "15 2022.03.03 \n", "16 2022.03.01 \n", "17 2022.03.01 \n", "18 2022.03.01 \n", "19 2022.03.01 \n", "20 2022.03.02 \n", "21 2022.03.03 \n", "22 2022.03.04 \n", "23 2022.03.05 \n", "24 2022.03.05 \n", "25 2022.03.05 \n", "26 2022.03.05 \n", "27 2022.03.05 \n", "28 2022.03.05 \n", "29 2022.03.05 \n", "30 2022.03.05 \n", "31 2022.03.05 \n", "32 2022.03.05 \n", "33 2022.03.05 \n", "34 2022.03.05 " ] }, "execution_count": 616, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test_data" ] }, { "cell_type": "code", "execution_count": 617, "id": "d3883c38-961c-49f1-b03f-18f72a60dbc3", "metadata": {}, "outputs": [], "source": [ "train_data['LABEL'] = train_data['LABEL'].replace([0, 1, -1],[0, 1, 2])\n", "test_data['LABEL'] = test_data['LABEL'].replace([0, 1, -1],[0, 1, 2])" ] }, { "cell_type": "code", "execution_count": 618, "id": "93ed1d83-0d55-4042-bfe9-0d16dc03d077", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 618, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAGrCAYAAABg7vUvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAXgElEQVR4nO3df2xV9f348VehUBzQMmC2EEp0cQqO6LTbpFPRYScSozBJpmZuwsiMs5hBt8w12TQyN8yyiCPjx+IqxETCQjLd2JxmQ0WNgFCCczNDzVzogq0zCy12Ugi93z8W+/l2IK5QXqXt45GcxL7Pufe+Gq/2mXPPvbeoUCgUAgAgyZC+HgAAGFzEBwCQSnwAAKnEBwCQSnwAAKnEBwCQSnwAAKmK+3qA/9bZ2Rn79u2L0aNHR1FRUV+PAwD8DwqFQhw4cCAmTpwYQ4Yc/9zGaRcf+/bti8rKyr4eAwA4AU1NTTFp0qTjHnPaxcfo0aMj4j/Dl5aW9vE0AMD/oq2t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08++yz8dRTT0VZWVksXLgw6urqYuzYsVFaWhp33nlnVFdXe6cLANClR/Hx9ttvx1e/+tV46623oqysLC644IJ46qmn4gtf+EJERCxfvjyGDBkS8+bNi46Ojpg1a1asWrXqlAwOAPRPPYqPhoaG4+4fMWJErFy5MlauXHlSQwEAA5fvdgEAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACBVcV8PAMDAddZ3f9fXIwwYf7//2r4eodc48wEApBIfAEAq8QEApOpRfCxbtiw+85nPxOjRo+PMM8+MuXPnxp49e7odc/DgwaitrY1x48bFqFGjYt68edHS0tKrQwMA/VeP4mPLli1RW1sb27Ztiz/84Q9x+PDhuPrqq6O9vb3rmCVLlsSmTZti48aNsWXLlti3b1/ccMMNvT44ANA/9ejdLk8++WS3n9etWxdnnnlmNDY2xowZM6K1tTUaGhpi/fr1MXPmzIiIWLt2bUydOjW2bdsW06dPP+o+Ozo6oqOjo+vntra2E/k9AIB+4qSu+WhtbY2IiLFjx0ZERGNjYxw+fDhqamq6jpkyZUpMnjw5tm7desz7WLZsWZSVlXVtlZWVJzMSAHCaO+H46OzsjMWLF8ell14a06ZNi4iI5ubmGD58eIwZM6bbseXl5dHc3HzM+6mvr4/W1tauramp6URHAgD6gRP+kLHa2tr485//HC+88MJJDVBSUhIlJSUndR8AQP9xQmc+Fi1aFL/97W/jmWeeiUmTJnWtV1RUxKFDh2L//v3djm9paYmKioqTGhQAGBh6FB+FQiEWLV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PPHEE8fcf8cdd8SaNWuis7MzebLBRXwAAKl8zgcAkEp8AACpxAcAkEp8AACpxAcAkEp8AMc1f/78mDt37nGP+cc//hHDhw+PadOmHXN/UVFR11ZcXByTJ0+Ourq66Ojo6Drm/Y9i/+9txIgRPZoFOP35kDHgpL3/gWHPPfdcbN++PS655JKjjlm7dm1cc801cfjw4Xj55ZdjwYIFMXLkyPjBD37QdUxpaWns2bOn2+18JQAMPOIDOCmFQiHWrl0bq1atikmTJkVDQ8Mx42PMmDFRUVERERGVlZUxZ86c2LVrV7djioqKuo4BBi4vuwAn5Zlnnol///vfUVNTE7fcckts2LAh2tvbj3ub1157LZ5++uljRgow8IkP4KQ0NDTETTfdFEOHDo1p06bFxz/+8di4ceNRx918880xatSoGDFiRJx33nnxyU9+Murr67sd09raGqNGjeq2zZ49O+tXAZJ42QU4Yfv3749f/epX8cILL3St3XLLLdHQ0BDz58/vduzy5cujpqYmjhw5Em+88UbU1dXFV77yldiwYUPXMaNHjz7qpZgzzjjjlP4OQD7xAZyw9evXx8GDB7u9fFIoFKKzszNee+21OPfcc7vWKyoq4pxzzomIiPPOOy8OHDgQN998c9x3331d60OGDOn6Z2Dg8rILcMIaGhriW9/6Vuzevbtre/nll+Pyyy+Phx9++Li3HTp0aEREvPfeexmjAqcRZz6AD9Xa2hq7d+/utnbgwIHYtWtXPProozFlypRu+26++eZYunRp3HfffVFc/J//zezfvz+am5ujs7MzXn/99Vi6dGmce+65MXXq1K7bFQqFaG5uPurxzzzzzBgyZMgHzjJu3LiorKzshd8UyCA+gA/17LPPxkUXXdRtbf78+XH++ecfFR4REV/84hdj0aJF8cQTT8T1118fERELFiyIiP97O+2MGTPiRz/6UVecRES0tbXFhAkTjrq/t956q+stuMeaZeHChfGLX/zi5H5JIE1RoVAo9PUQAMDg4ZoPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACCV+AAAUokPACDV/wM6LjkSOpmIuQAAAABJRU5ErkJggg==", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "train_data['LABEL'].value_counts().plot(kind='bar')" ] }, { "cell_type": "code", "execution_count": 619, "id": "a276e9dc-fa59-4ffe-a93d-26211c10c99a", "metadata": {}, "outputs": [], "source": [ "stopwords = ['도', '는', '다', '의', '가', '이', '은', '한', '에', '하', '고', '을', '를', '인', '듯', '과', '와', '네', '들', '듯', '지', '임', '게', '만', '게임', '겜', '되', '음', '면']" ] }, { "cell_type": "code", "execution_count": 620, "id": "44f1c1bb-19d9-45bb-a5c2-fd1a65d4531f", "metadata": {}, "outputs": [], "source": [ "train_data['CONTENT'] = train_data['CONTENT'].str.replace(\"[^ㄱ-ㅎㅏ-ㅣ가-힣 ]\",\"\", regex=True)\n", "train_data['CONTENT'].replace('', np.nan, inplace=True)\n", "train_data = train_data.dropna(how='any') # Null 값 제거" ] }, { "cell_type": "code", "execution_count": 621, "id": "4c4e3fda-4b5c-4fac-b17c-dc3b41ab2220", "metadata": {}, "outputs": [], "source": [ "test_data['CONTENT'] = test_data['CONTENT'].str.replace(\"[^ㄱ-ㅎㅏ-ㅣ가-힣 ]\",\"\", regex=True)\n", "test_data['CONTENT'].replace('', np.nan, inplace=True) # 공백은 Null 값으로 변경\n", "test_data = test_data.dropna(how='any') # Null 값 제거" ] }, { "cell_type": "code", "execution_count": 622, "id": "1386dae6-a373-41e1-96b5-69764acbcbc3", "metadata": {}, "outputs": [], "source": [ "okt = Okt()\n", "def preprocess_text(data):\n", " data['CONTENT'] = data['CONTENT'].str.replace(\"[^ㄱ-ㅎㅏ-ㅣ가-힣 ]\",\"\", regex=True)\n", " data['CONTENT'].replace('', np.nan, inplace=True)\n", " data.dropna(how='any', inplace=True) \n", " data['tokenized'] = data['CONTENT'].apply(okt.morphs)\n", " data['tokenized'] = data['tokenized'].apply(lambda x: [item for item in x if item not in stopwords])\n", " return data" ] }, { "cell_type": "code", "execution_count": 623, "id": "d715cc25-82d9-4588-94cd-e1fa7b57a3cd", "metadata": {}, "outputs": [], "source": [ "train_data = preprocess_text(train_data)\n", "test_data = preprocess_text(test_data)" ] }, { "cell_type": "code", "execution_count": 624, "id": "d763cbd0-5917-4ed5-8b45-0bf111be5656", "metadata": {}, "outputs": [], "source": [ "# 토큰화 및 정수 인코딩\n", "tokenizer = Tokenizer()\n", "tokenizer.fit_on_texts(train_data['tokenized'])\n", "X_train = tokenizer.texts_to_sequences(train_data['tokenized'])\n", "X_test = tokenizer.texts_to_sequences(test_data['tokenized'])" ] }, { "cell_type": "code", "execution_count": 625, "id": "1b2ca148-6dcd-4d4e-8274-42b8cf6d254e", "metadata": {}, "outputs": [], "source": [ "# 패딩\n", "max_len = 500\n", "X_train = pad_sequences(X_train, maxlen=max_len)\n", "X_test = pad_sequences(X_test, maxlen=max_len)" ] }, { "cell_type": "code", "execution_count": 626, "id": "a089a4a5-bce9-4608-9aae-b5965f8a0ade", "metadata": {}, "outputs": [], "source": [ "# 레이블 원-핫 인코딩\n", "y_train = to_categorical(train_data['LABEL'])\n", "y_test = to_categorical(test_data['LABEL'])\n" ] }, { "cell_type": "code", "execution_count": 627, "id": "4b110bdc-fa60-4158-a039-0b93feaef15a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 0. 1.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [0. 0. 1.]\n", " [0. 1. 0.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 0. 1.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [0. 0. 1.]\n", " [0. 1. 0.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 0. 1.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [1. 0. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [0. 1. 0.]\n", " [1. 0. 0.]\n", " [0. 0. 1.]\n", " [0. 1. 0.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]\n", " [0. 0. 1.]]\n" ] } ], "source": [ "print(y_train)" ] }, { "cell_type": "code", "execution_count": 628, "id": "6a6e5d39-6bf3-4cf3-bfc6-a4a51fb13d53", "metadata": { "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-03-07 02:44:20.532781: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:20.534502: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:20.535621: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:20.980296: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:21.125819: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:21.127054: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:21.128166: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:21.757401: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:21.759046: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:21.760173: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:22.151245: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:22.296288: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:22.297525: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:22.298635: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Epoch 1/10\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "2024-03-07 02:44:23.108504: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:23.110326: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:23.111550: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:23.558554: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:23.707386: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:23.708785: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:23.710009: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:24.252970: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:24.254788: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:24.256043: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:24.652910: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:24.801933: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:24.803344: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:24.804597: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:26.115599: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:27.365867: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:28.844176: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:28.846096: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:28.847322: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:29.235981: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:29.381081: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:29.382486: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:29.383706: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:29.914751: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:29.916624: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:29.917863: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:30.305127: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:30.451497: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:30.452939: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:30.454171: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:31.782948: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:32.951935: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2/2 [==============================] - ETA: 0s - loss: 1.0935 - accuracy: 0.4048 " ] }, { "name": "stderr", "output_type": "stream", "text": [ "2024-03-07 02:44:39.085388: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:39.087220: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:39.088397: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:39.631030: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:39.837304: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:39.838901: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:39.840068: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:40.564410: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:40.566071: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:40.567213: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:44:41.077300: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:44:41.270924: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:44:41.272245: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:44:41.273398: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2/2 [==============================] - 20s 5s/step - loss: 1.0935 - accuracy: 0.4048 - val_loss: 1.0584 - val_accuracy: 0.6190\n", "Epoch 2/10\n", "2/2 [==============================] - 3s 1s/step - loss: 1.0591 - accuracy: 0.5238 - val_loss: 1.0622 - val_accuracy: 0.2857\n", "Epoch 3/10\n", "2/2 [==============================] - 3s 1s/step - loss: 1.0537 - accuracy: 0.3929 - val_loss: 1.0340 - val_accuracy: 0.5238\n", "Epoch 4/10\n", "2/2 [==============================] - 3s 1s/step - loss: 1.0449 - accuracy: 0.4643 - val_loss: 1.0038 - val_accuracy: 0.5238\n", "Epoch 5/10\n", "2/2 [==============================] - 3s 1s/step - loss: 1.0332 - accuracy: 0.4048 - val_loss: 0.9935 - val_accuracy: 0.5238\n", "Epoch 6/10\n", "2/2 [==============================] - 3s 1s/step - loss: 1.0206 - accuracy: 0.4048 - val_loss: 0.9827 - val_accuracy: 0.5238\n", "Epoch 7/10\n", "2/2 [==============================] - 3s 1s/step - loss: 1.0040 - accuracy: 0.4762 - val_loss: 0.9514 - val_accuracy: 0.6667\n", "Epoch 8/10\n", "2/2 [==============================] - 3s 1s/step - loss: 0.9694 - accuracy: 0.6667 - val_loss: 0.8780 - val_accuracy: 0.7619\n", "Epoch 9/10\n", "2/2 [==============================] - 3s 1s/step - loss: 0.9038 - accuracy: 0.7381 - val_loss: 0.7355 - val_accuracy: 0.8095\n", "Epoch 10/10\n", "2/2 [==============================] - 3s 1s/step - loss: 0.7667 - accuracy: 0.7976 - val_loss: 0.5155 - val_accuracy: 0.8095\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "2024-03-07 02:45:08.099680: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:08.101467: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:08.102593: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:08.519532: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:45:08.673740: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:08.674982: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:08.676117: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:09.326924: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:09.328588: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:09.329688: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:09.733140: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:45:09.883193: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:09.884423: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:09.885530: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:10.814191: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:10.815727: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:10.816971: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:11.215583: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:45:11.363367: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:11.364610: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:11.365735: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:11.903237: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:11.904912: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:11.906051: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:12.295523: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:45:12.439259: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:12.440531: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:12.441662: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2/2 [==============================] - 3s 135ms/step - loss: 0.5694 - accuracy: 0.8000\n", "Test Loss: 0.5694, Test Accuracy: 0.8000\n" ] } ], "source": [ "# 모델 구성\n", "vocab_size = len(tokenizer.word_index) + 1 # 단어 사전 크기\n", "embedding_dim = 128 # 임베딩 차원\n", "hidden_units = 128 # LSTM 유닛 수\n", "\n", "model = Sequential()\n", "model.add(Embedding(vocab_size, embedding_dim))\n", "model.add(Bidirectional(LSTM(hidden_units, return_sequences=True)))\n", "model.add(Bidirectional(LSTM(hidden_units)))\n", "model.add(Dense(3, activation='softmax')) # 3개의 출력 레이어 (긍정, 부정, 중립)\n", "\n", "# 모델 컴파일\n", "model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])\n", "\n", "# 클래스 가중치 계산\n", "classes = np.unique(np.argmax(y_train, axis=1))\n", "class_weights = compute_class_weight('balanced', classes=classes, y=classes)\n", "class_weight_dict = dict(zip(classes, class_weights))\n", "\n", "# 콜백 설정 (조기 종료 및 최적 모델 저장)\n", "early_stopping = EarlyStopping(monitor='val_loss', patience=5)\n", "checkpoint = ModelCheckpoint('best_model.h5', monitor='val_loss', save_best_only=True)\n", "\n", "\n", "# 모델 학습\n", "#history = model.fit(X_train, y_train, epochs=50, batch_size=64, validation_split=0.2, callbacks=[early_stopping, checkpoint])\n", "history = model.fit(X_train, y_train, epochs=10, batch_size=64, validation_split=0.2,\n", " class_weight=class_weight_dict, callbacks=[early_stopping, checkpoint])\n", "# 모델 평가\n", "model = load_model('best_model.h5')\n", "test_loss, test_acc = model.evaluate(X_test, y_test)\n", "print('Test Loss: {:.4f}, Test Accuracy: {:.4f}'.format(test_loss, test_acc))" ] }, { "cell_type": "code", "execution_count": 629, "id": "1967ad52-3ab1-4eb7-b8cd-77f12cf53d27", "metadata": {}, "outputs": [], "source": [ "def predict_sentiment(text):\n", " # 1. 사용자 입력 텍스트 전처리\n", " text = re.sub(\"[^ㄱ-ㅎㅏ-ㅣ가-힣 ]\",\"\", text)\n", " \n", " tokenized_text = okt.morphs(text)\n", " \n", " tokenized_text = [word for word in tokenized_text if word not in stopwords]\n", " \n", " # 2. 텍스트 토큰화 및 패딩\n", " encoded_text = tokenizer.texts_to_sequences([tokenized_text])\n", " \n", " padded_text = pad_sequences(encoded_text, maxlen=max_len)\n", " \n", "\n", " # 3. 예측 수행\n", " score = model.predict(padded_text)\n", " print(score)\n", " label = np.argmax(score, axis=1)\n", " print(label)\n", " # 4. 결과 출력\n", " if label == 0:\n", " print(\"중립\")\n", " elif label == 1:\n", " print(\"긍정\")\n", " else:\n", " print(\"부정\")" ] }, { "cell_type": "code", "execution_count": 630, "id": "561fd613-cf81-4304-8e85-499dd9df9cf6", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-03-07 02:45:14.226242: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:14.227633: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:14.229066: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:14.620066: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:45:14.771241: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:14.772556: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:14.773677: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:15.307676: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:15.309403: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:15.310542: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n", "2024-03-07 02:45:15.699798: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis' with dtype int32 and shape [1]\n", "\t [[{{node gradients/ReverseV2_grad/ReverseV2/ReverseV2/axis}}]]\n", "2024-03-07 02:45:15.844016: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_2_grad/concat/split_2/split_dim' with dtype int32\n", "\t [[{{node gradients/split_2_grad/concat/split_2/split_dim}}]]\n", "2024-03-07 02:45:15.845278: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_grad/concat/split/split_dim' with dtype int32\n", "\t [[{{node gradients/split_grad/concat/split/split_dim}}]]\n", "2024-03-07 02:45:15.846408: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'gradients/split_1_grad/concat/split_1/split_dim' with dtype int32\n", "\t [[{{node gradients/split_1_grad/concat/split_1/split_dim}}]]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "1/1 [==============================] - 3s 3s/step\n", "[[0.24383551 0.5696524 0.1865121 ]]\n", "[1]\n", "긍정\n" ] } ], "source": [ "#사용자 입력 예시\n", "user_input = \"긍정입니다\"\n", "predict_sentiment(user_input)" ] }, { "cell_type": "code", "execution_count": 631, "id": "91ff8dbd-c60b-410f-b295-63e3a56efa39", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2/2 [==============================] - 1s 143ms/step\n", "F1 score: 0.80\n" ] } ], "source": [ "# 모델 예측 및 F1 점수 계산\n", "from sklearn.metrics import f1_score, classification_report\n", "\n", "y_pred = model.predict(X_test)\n", "y_pred_classes = np.argmax(y_pred, axis=1)\n", "y_true = np.argmax(y_test, axis=1)\n", "\n", "f1_micro = f1_score(y_true, y_pred_classes, average='micro')\n", "\n", "print(f'F1 score: {f1_micro:.2f}')\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e542c198-dc1e-4569-bceb-88d8efbce50c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "ec76f5f2-49f2-42b3-8c16-590209c49720", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "7275fb98-d495-4680-8128-2d6772e8b19a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "dc811d57-40f7-47eb-b6f6-a544951c8917", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "f86ab85a-bda8-438e-8dcb-23acec78aa47", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "8c222de1-6ddb-48a6-b572-3ac64e2cbc95", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "61463a65-e006-4864-bcc2-f3a9614f0711", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "fbbb357f-26c7-4e0a-abf0-377f809584c8", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "cf423d6f-b62d-4f3e-989d-7e2cc39af673", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "f929ac00-84e9-4c00-84d6-8f6ad8cc55dc", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "baeb6786-b34b-4403-910b-1420e1fcbf76", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "226fdc78-d084-4a8b-b6a0-1791de3ecdeb", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "a63cfb8d-0e66-41df-80ba-b0974b77be62", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "e23efbb1-3b27-4b0b-9179-4db99dec76ac", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "ab4ae44c-5c0c-46d2-8206-2a45b9a7c027", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "6456c941-2bcd-4543-9120-e9133509e77b", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "54d7e314-72e2-49fc-ade8-c907a9cf7106", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "880ff203-5666-44b0-9661-7a5e60b0126f", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "7ede8c2f-05fb-4c8b-a0ec-436745f2ff7c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "ff7e20ca-3229-4341-bb2c-79994605c018", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "508a43a4-3e6e-4111-a000-e6c776495fb5", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "19137f87-2d3f-4351-8453-0957c44034b8", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "cc62630d-74c8-450e-91b2-e8402b359052", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "288d0a5c-0862-4521-b8fe-a455aba0d63e", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "f1c93845-71dd-4948-b6f4-7930d2119244", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "2afaf1ea-8974-4826-bf51-38c00d447b39", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "c3ee0994-3a44-436e-b783-95ffbf3ff86e", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "2fcf59c6-bd38-459c-8f7b-912055d85749", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "47f32605-e029-4e12-a28d-804815599b85", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "c6ee2cd9-77a6-444a-8339-7bc279c7ba26", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "29bfd8d1-a788-4bfa-997b-5426450a8772", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "e23fc674-f344-4b56-bb79-8fd3de5aada0", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.12" } }, "nbformat": 4, "nbformat_minor": 5 }