Skip to content

Instantly share code, notes, and snippets.

@snakers4
Created April 4, 2023 06:19
Show Gist options
  • Save snakers4/0d01b31e26f977a8545fe27e7ad31a1c to your computer and use it in GitHub Desktop.
Save snakers4/0d01b31e26f977a8545fe27e7ad31a1c to your computer and use it in GitHub Desktop.
temp
Display the source blob
Display the rendered blob
Raw
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session\nimport torch\nfrom torch import nn\nfrom torch.utils.data import DataLoader\nimport torch.optim as optim","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-04-02T18:30:02.008625Z","iopub.execute_input":"2023-04-02T18:30:02.009328Z","iopub.status.idle":"2023-04-02T18:30:04.758970Z","shell.execute_reply.started":"2023-04-02T18:30:02.009298Z","shell.execute_reply":"2023-04-02T18:30:04.757803Z"},"trusted":true},"execution_count":1,"outputs":[{"name":"stdout","text":"/kaggle/input/silero-stress-predictor/sample_submission.csv\n/kaggle/input/silero-stress-predictor/train.csv\n/kaggle/input/silero-stress-predictor/test.csv\n","output_type":"stream"}]},{"cell_type":"code","source":"torch.cuda.is_available()","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:04.761262Z","iopub.execute_input":"2023-04-02T18:30:04.761794Z","iopub.status.idle":"2023-04-02T18:30:04.843866Z","shell.execute_reply.started":"2023-04-02T18:30:04.761754Z","shell.execute_reply":"2023-04-02T18:30:04.842113Z"},"trusted":true},"execution_count":2,"outputs":[{"execution_count":2,"output_type":"execute_result","data":{"text/plain":"True"},"metadata":{}}]},{"cell_type":"code","source":"device = 'cuda' if torch.cuda.is_available() else 'cpu'","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:04.845010Z","iopub.execute_input":"2023-04-02T18:30:04.845401Z","iopub.status.idle":"2023-04-02T18:30:04.852435Z","shell.execute_reply.started":"2023-04-02T18:30:04.845363Z","shell.execute_reply":"2023-04-02T18:30:04.851256Z"},"trusted":true},"execution_count":3,"outputs":[]},{"cell_type":"markdown","source":"# Предобработка","metadata":{}},{"cell_type":"code","source":"train = pd.read_csv(\"/kaggle/input/silero-stress-predictor/train.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:04.855676Z","iopub.execute_input":"2023-04-02T18:30:04.856258Z","iopub.status.idle":"2023-04-02T18:30:05.033608Z","shell.execute_reply.started":"2023-04-02T18:30:04.856218Z","shell.execute_reply":"2023-04-02T18:30:05.032496Z"},"trusted":true},"execution_count":4,"outputs":[]},{"cell_type":"code","source":"train","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:05.038925Z","iopub.execute_input":"2023-04-02T18:30:05.041482Z","iopub.status.idle":"2023-04-02T18:30:05.072535Z","shell.execute_reply.started":"2023-04-02T18:30:05.041426Z","shell.execute_reply":"2023-04-02T18:30:05.071457Z"},"trusted":true},"execution_count":5,"outputs":[{"execution_count":5,"output_type":"execute_result","data":{"text/plain":" id word stress num_syllables lemma\n0 0 румяной 2 3 румяный\n1 1 цифрами 1 3 цифра\n2 2 слугами 1 3 слуга\n3 3 выбирает 3 4 выбирать\n4 4 управдом 3 3 управдом\n... ... ... ... ... ...\n63433 63433 экзамена 2 4 экзамен\n63434 63434 культурой 2 3 культура\n63435 63435 объемной 2 3 объемный\n63436 63436 участком 2 3 участок\n63437 63437 ташкента 2 3 ташкент\n\n[63438 rows x 5 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>id</th>\n <th>word</th>\n <th>stress</th>\n <th>num_syllables</th>\n <th>lemma</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0</td>\n <td>румяной</td>\n <td>2</td>\n <td>3</td>\n <td>румяный</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n <td>цифрами</td>\n <td>1</td>\n <td>3</td>\n <td>цифра</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2</td>\n <td>слугами</td>\n <td>1</td>\n <td>3</td>\n <td>слуга</td>\n </tr>\n <tr>\n <th>3</th>\n <td>3</td>\n <td>выбирает</td>\n <td>3</td>\n <td>4</td>\n <td>выбирать</td>\n </tr>\n <tr>\n <th>4</th>\n <td>4</td>\n <td>управдом</td>\n <td>3</td>\n <td>3</td>\n <td>управдом</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>63433</th>\n <td>63433</td>\n <td>экзамена</td>\n <td>2</td>\n <td>4</td>\n <td>экзамен</td>\n </tr>\n <tr>\n <th>63434</th>\n <td>63434</td>\n <td>культурой</td>\n <td>2</td>\n <td>3</td>\n <td>культура</td>\n </tr>\n <tr>\n <th>63435</th>\n <td>63435</td>\n <td>объемной</td>\n <td>2</td>\n <td>3</td>\n <td>объемный</td>\n </tr>\n <tr>\n <th>63436</th>\n <td>63436</td>\n <td>участком</td>\n <td>2</td>\n <td>3</td>\n <td>участок</td>\n </tr>\n <tr>\n <th>63437</th>\n <td>63437</td>\n <td>ташкента</td>\n <td>2</td>\n <td>3</td>\n <td>ташкент</td>\n </tr>\n </tbody>\n</table>\n<p>63438 rows × 5 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"def simple_splitter(word):\n word = word.lower()\n vowels = ['а', 'у', 'о', 'ы', 'э', 'я', 'ю', 'ё', 'и', 'е']\n for s in word:\n if s in vowels:\n word = word.replace(s, s + '|')\n vowels.remove(s)\n syl = word.split('|')\n if syl[-1] not in vowels:\n syl[-2] = syl[-2] + syl[-1]\n syl.pop(-1)\n return syl","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:05.077051Z","iopub.execute_input":"2023-04-02T18:30:05.079617Z","iopub.status.idle":"2023-04-02T18:30:05.086623Z","shell.execute_reply.started":"2023-04-02T18:30:05.079572Z","shell.execute_reply":"2023-04-02T18:30:05.085708Z"},"trusted":true},"execution_count":6,"outputs":[]},{"cell_type":"code","source":"# all_words = [['UNK'], ['PAD']]\n# for i in train['word']:\n# all_words.append(simple_splitter(i))","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:05.087970Z","iopub.execute_input":"2023-04-02T18:30:05.089438Z","iopub.status.idle":"2023-04-02T18:30:05.096609Z","shell.execute_reply.started":"2023-04-02T18:30:05.089399Z","shell.execute_reply":"2023-04-02T18:30:05.095210Z"},"trusted":true},"execution_count":7,"outputs":[]},{"cell_type":"code","source":"# from gensim.models import Word2Vec\n\n# W2Vmodel = Word2Vec(sentences=all_words, vector_size=30, window=2, min_count=1, workers=4)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:05.098659Z","iopub.execute_input":"2023-04-02T18:30:05.099430Z","iopub.status.idle":"2023-04-02T18:30:05.108085Z","shell.execute_reply.started":"2023-04-02T18:30:05.099393Z","shell.execute_reply":"2023-04-02T18:30:05.107140Z"},"trusted":true},"execution_count":8,"outputs":[]},{"cell_type":"code","source":"all_sylls = [['UNK'], ['PAD']]\nfor i in train['word']:\n all_sylls.append(simple_splitter(i))\n \nnp_sylls = np.concatenate(all_sylls)\n\nfull_dict_sylls = dict(zip(set(np_sylls), range(0, len(set(np_sylls))))) ## Словарь всех слогов вида слог:индекс\n\nlen(full_dict_sylls)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:05.109979Z","iopub.execute_input":"2023-04-02T18:30:05.110746Z","iopub.status.idle":"2023-04-02T18:30:06.040306Z","shell.execute_reply.started":"2023-04-02T18:30:05.110710Z","shell.execute_reply":"2023-04-02T18:30:06.039203Z"},"trusted":true},"execution_count":9,"outputs":[{"execution_count":9,"output_type":"execute_result","data":{"text/plain":"7996"},"metadata":{}}]},{"cell_type":"code","source":"def word2ind(word):\n inds = []\n sylls = simple_splitter(word)\n for s in sylls:\n try:\n inds.append(full_dict_sylls[s])\n except KeyError:\n inds.append(full_dict_sylls['UNK'])\n while len(inds) < 6:\n inds.append(full_dict_sylls['PAD'])\n \n if len(inds) > 6: inds = inds[:6]\n \n return inds","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:06.044800Z","iopub.execute_input":"2023-04-02T18:30:06.045590Z","iopub.status.idle":"2023-04-02T18:30:06.052943Z","shell.execute_reply.started":"2023-04-02T18:30:06.045553Z","shell.execute_reply":"2023-04-02T18:30:06.051636Z"},"trusted":true},"execution_count":10,"outputs":[]},{"cell_type":"code","source":"def word2indW2V(word):\n inds = []\n sylls = simple_splitter(word)\n for s in sylls:\n try:\n inds.append(W2Vmodel.wv[s])\n except KeyError:\n inds.append(W2Vmodel.wv['UNK'])\n while len(inds) < 6:\n inds.append(W2Vmodel.wv['PAD'])\n \n return torch.tensor(inds)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:06.054953Z","iopub.execute_input":"2023-04-02T18:30:06.055892Z","iopub.status.idle":"2023-04-02T18:30:06.069930Z","shell.execute_reply.started":"2023-04-02T18:30:06.055782Z","shell.execute_reply":"2023-04-02T18:30:06.065950Z"},"trusted":true},"execution_count":11,"outputs":[]},{"cell_type":"code","source":"# tenz = torch.zeros((words.shape[0], words.shape[1], 30), dtype=torch.float32)\n# tenz.shape","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:06.073531Z","iopub.execute_input":"2023-04-02T18:30:06.074242Z","iopub.status.idle":"2023-04-02T18:30:06.079871Z","shell.execute_reply.started":"2023-04-02T18:30:06.074204Z","shell.execute_reply":"2023-04-02T18:30:06.078705Z"},"trusted":true},"execution_count":12,"outputs":[]},{"cell_type":"code","source":"# for i, word in enumerate(train['word']):\n# vect = word2indW2V(word)\n# # vect = torch.unsqueeze(vect, dim=0)\n# tenz[i, :] = vect","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:06.082866Z","iopub.execute_input":"2023-04-02T18:30:06.084631Z","iopub.status.idle":"2023-04-02T18:30:06.092892Z","shell.execute_reply.started":"2023-04-02T18:30:06.084594Z","shell.execute_reply":"2023-04-02T18:30:06.089714Z"},"trusted":true},"execution_count":13,"outputs":[]},{"cell_type":"code","source":"trainRxWord = train[['word']].applymap(word2ind)\nwords = pd.DataFrame(trainRxWord['word'].to_list(), columns = ['w1', 'w2', 'w3', 'w4', 'w5', 'w6'])\nwordsNN = torch.tensor(words.values.astype(np.int32))\nwordsNN","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:06.095008Z","iopub.execute_input":"2023-04-02T18:30:06.095570Z","iopub.status.idle":"2023-04-02T18:30:07.035041Z","shell.execute_reply.started":"2023-04-02T18:30:06.095533Z","shell.execute_reply":"2023-04-02T18:30:07.034023Z"},"trusted":true},"execution_count":14,"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":"tensor([[5473, 5755, 7914, 6397, 6397, 6397],\n [6934, 1393, 7036, 6397, 6397, 6397],\n [6657, 949, 7036, 6397, 6397, 6397],\n ...,\n [7904, 1615, 2184, 6397, 6397, 6397],\n [ 388, 1260, 266, 6397, 6397, 6397],\n [4196, 3011, 1923, 6397, 6397, 6397]], dtype=torch.int32)"},"metadata":{}}]},{"cell_type":"code","source":"trainRxLemm = train[['lemma']].applymap(word2ind)\nlemms = pd.DataFrame(trainRxLemm['lemma'].to_list(), columns = ['l1', 'l2', 'l3', 'l4', 'l5', 'l6'])\nlemmsNN = torch.tensor(words.values.astype(np.int32))\nlemmsNN","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:07.036436Z","iopub.execute_input":"2023-04-02T18:30:07.036809Z","iopub.status.idle":"2023-04-02T18:30:07.490260Z","shell.execute_reply.started":"2023-04-02T18:30:07.036771Z","shell.execute_reply":"2023-04-02T18:30:07.489263Z"},"trusted":true},"execution_count":15,"outputs":[{"execution_count":15,"output_type":"execute_result","data":{"text/plain":"tensor([[5473, 5755, 7914, 6397, 6397, 6397],\n [6934, 1393, 7036, 6397, 6397, 6397],\n [6657, 949, 7036, 6397, 6397, 6397],\n ...,\n [7904, 1615, 2184, 6397, 6397, 6397],\n [ 388, 1260, 266, 6397, 6397, 6397],\n [4196, 3011, 1923, 6397, 6397, 6397]], dtype=torch.int32)"},"metadata":{}}]},{"cell_type":"code","source":"# trX_NN = torch.tensor(pd.concat([words, lemms , train['num_syllables']], axis=1).values.astype(np.float32))\n# trX_NN.shape","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:07.493480Z","iopub.execute_input":"2023-04-02T18:30:07.493771Z","iopub.status.idle":"2023-04-02T18:30:07.500231Z","shell.execute_reply.started":"2023-04-02T18:30:07.493744Z","shell.execute_reply":"2023-04-02T18:30:07.499140Z"},"trusted":true},"execution_count":16,"outputs":[]},{"cell_type":"code","source":"trainRy = train['stress']\ntrainRy","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:07.501838Z","iopub.execute_input":"2023-04-02T18:30:07.502273Z","iopub.status.idle":"2023-04-02T18:30:07.513594Z","shell.execute_reply.started":"2023-04-02T18:30:07.502236Z","shell.execute_reply":"2023-04-02T18:30:07.512417Z"},"trusted":true},"execution_count":17,"outputs":[{"execution_count":17,"output_type":"execute_result","data":{"text/plain":"0 2\n1 1\n2 1\n3 3\n4 3\n ..\n63433 2\n63434 2\n63435 2\n63436 2\n63437 2\nName: stress, Length: 63438, dtype: int64"},"metadata":{}}]},{"cell_type":"markdown","source":"# ML","metadata":{}},{"cell_type":"markdown","source":"## Нейросеть","metadata":{}},{"cell_type":"code","source":"import torch\nfrom torch import nn\nfrom torch.utils.data import DataLoader\nimport torch.optim as optim","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:30:07.515073Z","iopub.execute_input":"2023-04-02T18:30:07.515554Z","iopub.status.idle":"2023-04-02T18:30:07.523761Z","shell.execute_reply.started":"2023-04-02T18:30:07.515518Z","shell.execute_reply":"2023-04-02T18:30:07.522783Z"},"trusted":true},"execution_count":18,"outputs":[]},{"cell_type":"code","source":"class SimpleNet(nn.Module):\n def __init__(self, embD):\n super().__init__()\n \n self.embD = embD\n \n self.emb = nn.Embedding(num_embeddings=7996, embedding_dim=self.embD)\n \n self.enc = nn.Sequential(\n nn.Conv1d(in_channels=self.embD, out_channels=self.embD + 5, kernel_size=2, padding='same'),\n nn.ReLU(),\n nn.Dropout1d(p=0.5),\n \n nn.Conv1d(in_channels=self.embD + 5, out_channels=self.embD + 10, kernel_size=3, padding='same'),\n nn.ReLU(),\n nn.Dropout1d(p=0.5),\n \n nn.Conv1d(in_channels=self.embD + 10, out_channels=self.embD + 15, kernel_size=4, padding='same'),\n nn.ReLU(),\n nn.Dropout1d(p=0.5),\n \n nn.Conv1d(in_channels=self.embD + 15, out_channels=self.embD + 20, kernel_size=5, padding='same'),\n nn.ReLU(),\n nn.Dropout1d(p=0.5),\n )\n\n self.lin = nn.Linear(in_features=self.embD + 20, out_features=1)\n\n\n def forward(self, x):\n\n x = self.emb(x)\n \n x = torch.permute(x, (0, 2, 1))\n \n x = self.enc(x)\n \n x = torch.permute(x, (0, 2, 1))\n \n x = self.lin(x)\n \n res = torch.squeeze(x, dim=2)\n\n return res","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:26:36.398218Z","iopub.execute_input":"2023-04-02T20:26:36.398881Z","iopub.status.idle":"2023-04-02T20:26:36.412722Z","shell.execute_reply.started":"2023-04-02T20:26:36.398844Z","shell.execute_reply":"2023-04-02T20:26:36.410790Z"},"trusted":true},"execution_count":195,"outputs":[]},{"cell_type":"code","source":"testMod = SimpleNet(embD=30).to(device)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:26:48.401480Z","iopub.execute_input":"2023-04-02T20:26:48.401839Z","iopub.status.idle":"2023-04-02T20:26:48.412644Z","shell.execute_reply.started":"2023-04-02T20:26:48.401805Z","shell.execute_reply":"2023-04-02T20:26:48.411614Z"},"trusted":true},"execution_count":197,"outputs":[]},{"cell_type":"code","source":"# trainSetLOL = tenz[:5]\n# trainSetLOL.shape","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:08.511637Z","iopub.execute_input":"2023-04-02T18:40:08.514023Z","iopub.status.idle":"2023-04-02T18:40:08.520010Z","shell.execute_reply.started":"2023-04-02T18:40:08.513981Z","shell.execute_reply":"2023-04-02T18:40:08.518863Z"},"trusted":true},"execution_count":49,"outputs":[]},{"cell_type":"code","source":"# trainSetLOL = trX_NN[:5]\n# # trainSetLOL = torch.tensor(trainSetLOL.values.astype(np.int32))\n# trainSetLOL","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:08.708400Z","iopub.execute_input":"2023-04-02T18:40:08.709075Z","iopub.status.idle":"2023-04-02T18:40:08.714075Z","shell.execute_reply.started":"2023-04-02T18:40:08.709041Z","shell.execute_reply":"2023-04-02T18:40:08.712799Z"},"trusted":true},"execution_count":50,"outputs":[]},{"cell_type":"code","source":"trainSetLOLw = wordsNN[:5].to(device)\ntrainSetLOLl = lemmsNN[:5].to(device)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:08.901320Z","iopub.execute_input":"2023-04-02T18:40:08.901634Z","iopub.status.idle":"2023-04-02T18:40:08.907528Z","shell.execute_reply.started":"2023-04-02T18:40:08.901604Z","shell.execute_reply":"2023-04-02T18:40:08.906360Z"},"trusted":true},"execution_count":51,"outputs":[]},{"cell_type":"code","source":"testMod(trainSetLOLw)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:26:51.004214Z","iopub.execute_input":"2023-04-02T20:26:51.005143Z","iopub.status.idle":"2023-04-02T20:26:51.017351Z","shell.execute_reply.started":"2023-04-02T20:26:51.005089Z","shell.execute_reply":"2023-04-02T20:26:51.016380Z"},"trusted":true},"execution_count":198,"outputs":[{"execution_count":198,"output_type":"execute_result","data":{"text/plain":"tensor([[-0.0495, -0.1283, -0.1177, -0.0029, -0.0055, -0.0037],\n [ 0.0411, 0.0404, 0.0161, 0.0371, 0.0468, 0.0281],\n [ 0.0249, 0.0228, 0.0543, 0.0550, 0.0291, 0.0340],\n [ 0.0382, 0.0095, -0.0020, 0.0237, -0.0323, 0.0058],\n [ 0.1027, 0.0657, 0.0143, 0.0167, -0.0228, -0.0014]],\n device='cuda:0', grad_fn=<SqueezeBackward1>)"},"metadata":{}}]},{"cell_type":"code","source":"# trainSetX = tenz[:60000]\n# trainSetX.shape","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:09.482148Z","iopub.execute_input":"2023-04-02T18:40:09.482624Z","iopub.status.idle":"2023-04-02T18:40:09.488489Z","shell.execute_reply.started":"2023-04-02T18:40:09.482589Z","shell.execute_reply":"2023-04-02T18:40:09.487201Z"},"trusted":true},"execution_count":53,"outputs":[]},{"cell_type":"code","source":"trainSetXw = wordsNN[:60000].to(device)\n# trainSetX = torch.tensor(trainSetX.values.astype(np.int32))\n\ntrainSetXw.shape","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:09.663183Z","iopub.execute_input":"2023-04-02T18:40:09.663486Z","iopub.status.idle":"2023-04-02T18:40:09.672244Z","shell.execute_reply.started":"2023-04-02T18:40:09.663457Z","shell.execute_reply":"2023-04-02T18:40:09.671160Z"},"trusted":true},"execution_count":54,"outputs":[{"execution_count":54,"output_type":"execute_result","data":{"text/plain":"torch.Size([60000, 6])"},"metadata":{}}]},{"cell_type":"code","source":"trainSetXl = lemmsNN[:60000].to(device)\n\ntrainSetXl.shape","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:09.919704Z","iopub.execute_input":"2023-04-02T18:40:09.920594Z","iopub.status.idle":"2023-04-02T18:40:09.930484Z","shell.execute_reply.started":"2023-04-02T18:40:09.920543Z","shell.execute_reply":"2023-04-02T18:40:09.929353Z"},"trusted":true},"execution_count":55,"outputs":[{"execution_count":55,"output_type":"execute_result","data":{"text/plain":"torch.Size([60000, 6])"},"metadata":{}}]},{"cell_type":"code","source":"trainSetY = train['stress'][:60000] - 1\ntrainSetY = torch.tensor(trainSetY.values.astype(np.float32)).to(device)\n# trainSetY = nn.functional.one_hot(trainSetY.long(), num_classes=6)\n\ntrainSetY.shape","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:10.312768Z","iopub.execute_input":"2023-04-02T18:40:10.313332Z","iopub.status.idle":"2023-04-02T18:40:10.323720Z","shell.execute_reply.started":"2023-04-02T18:40:10.313297Z","shell.execute_reply":"2023-04-02T18:40:10.322326Z"},"trusted":true},"execution_count":56,"outputs":[{"execution_count":56,"output_type":"execute_result","data":{"text/plain":"torch.Size([60000])"},"metadata":{}}]},{"cell_type":"code","source":"# testSetX = tenz[60000:]\n\n# testSetY = train['stress'][60000:] - 1\n# testSetY = torch.tensor(testSetY.values.astype(np.float32))","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:10.654757Z","iopub.execute_input":"2023-04-02T18:40:10.655636Z","iopub.status.idle":"2023-04-02T18:40:10.660577Z","shell.execute_reply.started":"2023-04-02T18:40:10.655586Z","shell.execute_reply":"2023-04-02T18:40:10.659446Z"},"trusted":true},"execution_count":57,"outputs":[]},{"cell_type":"code","source":"testSetXw = wordsNN[60000:].to(device)\ntestSetXl = lemmsNN[60000:].to(device)\n# testSetX = torch.tensor(testSetX.values.astype(np.int32))\n\ntestSetY = train['stress'][60000:] - 1\ntestSetY = torch.tensor(testSetY.values.astype(np.float32)).to(device)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T18:40:10.942936Z","iopub.execute_input":"2023-04-02T18:40:10.943631Z","iopub.status.idle":"2023-04-02T18:40:10.952316Z","shell.execute_reply.started":"2023-04-02T18:40:10.943593Z","shell.execute_reply":"2023-04-02T18:40:10.951271Z"},"trusted":true},"execution_count":58,"outputs":[]},{"cell_type":"code","source":"train_dataloader = DataLoader(list(zip(trainSetXw, trainSetY)), batch_size=150, shuffle=True)\ntest_dataloader = DataLoader(list(zip(testSetXw, testSetY)), batch_size=150, shuffle=True)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:27:00.000799Z","iopub.execute_input":"2023-04-02T20:27:00.001184Z","iopub.status.idle":"2023-04-02T20:27:00.600446Z","shell.execute_reply.started":"2023-04-02T20:27:00.001143Z","shell.execute_reply":"2023-04-02T20:27:00.599433Z"},"trusted":true},"execution_count":199,"outputs":[]},{"cell_type":"code","source":"testMod = SimpleNet(embD=300)\nn_epochs = 200\nloss_fn = nn.CrossEntropyLoss()\noptimizer = optim.Adam(testMod.parameters(), weight_decay=0.00001)\nscheduler = optim.lr_scheduler.ExponentialLR(optimizer, gamma=0.999)\ntestMod.train()","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:27:04.353521Z","iopub.execute_input":"2023-04-02T20:27:04.354462Z","iopub.status.idle":"2023-04-02T20:27:04.393673Z","shell.execute_reply.started":"2023-04-02T20:27:04.354408Z","shell.execute_reply":"2023-04-02T20:27:04.392027Z"},"trusted":true},"execution_count":200,"outputs":[{"execution_count":200,"output_type":"execute_result","data":{"text/plain":"SimpleNet(\n (emb): Embedding(7996, 300)\n (enc): Sequential(\n (0): Conv1d(300, 305, kernel_size=(2,), stride=(1,), padding=same)\n (1): ReLU()\n (2): Dropout1d(p=0.5, inplace=False)\n (3): Conv1d(305, 310, kernel_size=(3,), stride=(1,), padding=same)\n (4): ReLU()\n (5): Dropout1d(p=0.5, inplace=False)\n (6): Conv1d(310, 315, kernel_size=(4,), stride=(1,), padding=same)\n (7): ReLU()\n (8): Dropout1d(p=0.5, inplace=False)\n (9): Conv1d(315, 320, kernel_size=(5,), stride=(1,), padding=same)\n (10): ReLU()\n (11): Dropout1d(p=0.5, inplace=False)\n )\n (lin): Linear(in_features=320, out_features=1, bias=True)\n (sumLin): Sequential(\n (0): Linear(in_features=300, out_features=310, bias=True)\n (1): ReLU()\n (2): Dropout(p=0.3, inplace=False)\n (3): Linear(in_features=310, out_features=300, bias=True)\n (4): ReLU()\n )\n)"},"metadata":{}}]},{"cell_type":"code","source":"testMod.to(device)\nhigh_acc = 0.\neps_no_imp = 0\nfor ep in range(n_epochs):\n print(f\"Epoch {ep + 1}\")\n last_loss = 0.\n run_loss = 0.\n \n \n for i, data in enumerate(train_dataloader):\n optimizer.zero_grad()\n \n Xb, Yb = data\n \n ypred = testMod(Xb)\n \n loss = loss_fn(ypred, Yb.long())\n \n \n loss.backward()\n optimizer.step()\n \n \n run_loss += loss.item()\n \n if i % 100 == 99:\n last_loss = run_loss / 100\n print(f\"batch {i + 1}, loss {last_loss}\")\n run_loss = 0\n \n ## test check\n \n testMod.eval()\n y_pred = testMod(testSetXw)\n acc = (y_pred.argmax(1) == testSetY).float().mean()\n acc = float(acc)\n print(\"Model accuracy: %.2f%%\" % (acc*100))\n \n if acc > high_acc:\n print(f\"New highest accuracy: {acc}\")\n high_acc = acc\n torch.save(testMod.state_dict(), \"bestModel.pt\")\n eps_no_imp = 0\n else:\n eps_no_imp += 1\n \n if eps_no_imp == 20:\n print(f\"No improvement in accuracy. Stopping early\\n Best accuracy -> {high_acc}\")\n break\n \n testMod.train()\n \n ## end of check\n \n scheduler.step()\n print(f\"End of epoch {ep + 1}\\n-------------------------\")\n## 86.41","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:27:17.385019Z","iopub.execute_input":"2023-04-02T20:27:17.385704Z","iopub.status.idle":"2023-04-02T20:31:22.733795Z","shell.execute_reply.started":"2023-04-02T20:27:17.385669Z","shell.execute_reply":"2023-04-02T20:31:22.732707Z"},"trusted":true},"execution_count":201,"outputs":[{"name":"stdout","text":"Epoch 1\nbatch 100, loss 0.9018569391965866\nbatch 200, loss 0.7573528355360031\nbatch 300, loss 0.701995764374733\nbatch 400, loss 0.6737083846330643\nModel accuracy: 71.76%\nNew highest accuracy: 0.7175683975219727\nEnd of epoch 1\n-------------------------\nEpoch 2\nbatch 100, loss 0.6252882352471352\nbatch 200, loss 0.5996284347772598\nbatch 300, loss 0.6007369866967202\nbatch 400, loss 0.5757922276854515\nModel accuracy: 77.72%\nNew highest accuracy: 0.7771960496902466\nEnd of epoch 2\n-------------------------\nEpoch 3\nbatch 100, loss 0.5255890455842018\nbatch 200, loss 0.5299744012951851\nbatch 300, loss 0.5148718211054802\nbatch 400, loss 0.5161626166105271\nModel accuracy: 79.64%\nNew highest accuracy: 0.7963932752609253\nEnd of epoch 3\n-------------------------\nEpoch 4\nbatch 100, loss 0.4652759745717049\nbatch 200, loss 0.46547737628221514\nbatch 300, loss 0.46803209722042083\nbatch 400, loss 0.4587903994321823\nModel accuracy: 81.56%\nNew highest accuracy: 0.815590500831604\nEnd of epoch 4\n-------------------------\nEpoch 5\nbatch 100, loss 0.4154364788532257\nbatch 200, loss 0.42744381457567215\nbatch 300, loss 0.430217262506485\nbatch 400, loss 0.4258602997660637\nModel accuracy: 82.98%\nNew highest accuracy: 0.8298429846763611\nEnd of epoch 5\n-------------------------\nEpoch 6\nbatch 100, loss 0.37280248835682867\nbatch 200, loss 0.3994229930639267\nbatch 300, loss 0.3890038043260574\nbatch 400, loss 0.4004691049456596\nModel accuracy: 83.94%\nNew highest accuracy: 0.8394415974617004\nEnd of epoch 6\n-------------------------\nEpoch 7\nbatch 100, loss 0.3488214275240898\nbatch 200, loss 0.3608837823569775\nbatch 300, loss 0.3567549601197243\nbatch 400, loss 0.37874603986740113\nModel accuracy: 83.97%\nNew highest accuracy: 0.8397324681282043\nEnd of epoch 7\n-------------------------\nEpoch 8\nbatch 100, loss 0.32347454741597176\nbatch 200, loss 0.34386890560388567\nbatch 300, loss 0.3557080373167992\nbatch 400, loss 0.35328751638531686\nModel accuracy: 84.21%\nNew highest accuracy: 0.8420593738555908\nEnd of epoch 8\n-------------------------\nEpoch 9\nbatch 100, loss 0.308316530585289\nbatch 200, loss 0.31053061842918395\nbatch 300, loss 0.33456177726387976\nbatch 400, loss 0.34341296076774597\nModel accuracy: 84.38%\nNew highest accuracy: 0.8438045978546143\nEnd of epoch 9\n-------------------------\nEpoch 10\nbatch 100, loss 0.29412034586071967\nbatch 200, loss 0.30991573989391324\nbatch 300, loss 0.3167182119190693\nbatch 400, loss 0.32487204879522324\nModel accuracy: 85.31%\nNew highest accuracy: 0.8531123399734497\nEnd of epoch 10\n-------------------------\nEpoch 11\nbatch 100, loss 0.2885857158899307\nbatch 200, loss 0.2882878114283085\nbatch 300, loss 0.30791873157024385\nbatch 400, loss 0.3103193962574005\nModel accuracy: 85.14%\nEnd of epoch 11\n-------------------------\nEpoch 12\nbatch 100, loss 0.2718512934446335\nbatch 200, loss 0.2921528285741806\nbatch 300, loss 0.29038614735007284\nbatch 400, loss 0.2997064162790775\nModel accuracy: 85.89%\nNew highest accuracy: 0.8589296340942383\nEnd of epoch 12\n-------------------------\nEpoch 13\nbatch 100, loss 0.2612572342157364\nbatch 200, loss 0.27173383444547655\nbatch 300, loss 0.2815230955183506\nbatch 400, loss 0.29423739537596705\nModel accuracy: 85.95%\nNew highest accuracy: 0.8595113754272461\nEnd of epoch 13\n-------------------------\nEpoch 14\nbatch 100, loss 0.24721902281045913\nbatch 200, loss 0.27125407800078394\nbatch 300, loss 0.26293970689177515\nbatch 400, loss 0.27878078982234\nModel accuracy: 85.92%\nEnd of epoch 14\n-------------------------\nEpoch 15\nbatch 100, loss 0.24093874424695969\nbatch 200, loss 0.25243014097213745\nbatch 300, loss 0.25922741830348967\nbatch 400, loss 0.27497716680169104\nModel accuracy: 86.01%\nNew highest accuracy: 0.8600931167602539\nEnd of epoch 15\n-------------------------\nEpoch 16\nbatch 100, loss 0.231727212369442\nbatch 200, loss 0.2542976912856102\nbatch 300, loss 0.25651106528937817\nbatch 400, loss 0.26031990617513656\nModel accuracy: 86.36%\nNew highest accuracy: 0.863583505153656\nEnd of epoch 16\n-------------------------\nEpoch 17\nbatch 100, loss 0.2280552652478218\nbatch 200, loss 0.24291264697909354\nbatch 300, loss 0.25091256856918337\nbatch 400, loss 0.25288270488381387\nModel accuracy: 86.15%\nEnd of epoch 17\n-------------------------\nEpoch 18\nbatch 100, loss 0.21470939636230468\nbatch 200, loss 0.2422358785569668\nbatch 300, loss 0.2407553720474243\nbatch 400, loss 0.24177830010652543\nModel accuracy: 85.92%\nEnd of epoch 18\n-------------------------\nEpoch 19\nbatch 100, loss 0.21143778443336486\nbatch 200, loss 0.21626549579203128\nbatch 300, loss 0.24130339480936527\nbatch 400, loss 0.2430872191488743\nModel accuracy: 86.18%\nEnd of epoch 19\n-------------------------\nEpoch 20\nbatch 100, loss 0.20455520279705525\nbatch 200, loss 0.21826332837343215\nbatch 300, loss 0.2296634064614773\nbatch 400, loss 0.2398214316368103\nModel accuracy: 86.56%\nNew highest accuracy: 0.8656195998191833\nEnd of epoch 20\n-------------------------\nEpoch 21\nbatch 100, loss 0.20347689174115657\nbatch 200, loss 0.21140942648053168\nbatch 300, loss 0.2108816261589527\nbatch 400, loss 0.22860585793852806\nModel accuracy: 86.97%\nNew highest accuracy: 0.8696917295455933\nEnd of epoch 21\n-------------------------\nEpoch 22\nbatch 100, loss 0.1942390874028206\nbatch 200, loss 0.2099410466849804\nbatch 300, loss 0.2186720285564661\nbatch 400, loss 0.22552408687770367\nModel accuracy: 86.33%\nEnd of epoch 22\n-------------------------\nEpoch 23\nbatch 100, loss 0.18661766462028026\nbatch 200, loss 0.20858853705227376\nbatch 300, loss 0.20480633154511452\nbatch 400, loss 0.21510949850082398\nModel accuracy: 86.74%\nEnd of epoch 23\n-------------------------\nEpoch 24\nbatch 100, loss 0.17789838716387749\nbatch 200, loss 0.19294073104858397\nbatch 300, loss 0.20428663805127145\nbatch 400, loss 0.21487028874456882\nModel accuracy: 86.53%\nEnd of epoch 24\n-------------------------\nEpoch 25\nbatch 100, loss 0.1770741441845894\nbatch 200, loss 0.19298666790127755\nbatch 300, loss 0.19812761060893536\nbatch 400, loss 0.20529725089669226\nModel accuracy: 87.09%\nNew highest accuracy: 0.8708552122116089\nEnd of epoch 25\n-------------------------\nEpoch 26\nbatch 100, loss 0.17795370914041997\nbatch 200, loss 0.18348632037639617\nbatch 300, loss 0.19024646796286107\nbatch 400, loss 0.205008674710989\nModel accuracy: 86.24%\nEnd of epoch 26\n-------------------------\nEpoch 27\nbatch 100, loss 0.16751805812120438\nbatch 200, loss 0.1890131201595068\nbatch 300, loss 0.1924343678355217\nbatch 400, loss 0.20168838880956172\nModel accuracy: 86.91%\nEnd of epoch 27\n-------------------------\nEpoch 28\nbatch 100, loss 0.169182011783123\nbatch 200, loss 0.17790321715176105\nbatch 300, loss 0.1879586534947157\nbatch 400, loss 0.18292610198259354\nModel accuracy: 86.45%\nEnd of epoch 28\n-------------------------\nEpoch 29\nbatch 100, loss 0.1662400298565626\nbatch 200, loss 0.17537716835737227\nbatch 300, loss 0.17895046889781951\nbatch 400, loss 0.18686383858323097\nModel accuracy: 86.97%\nEnd of epoch 29\n-------------------------\nEpoch 30\nbatch 100, loss 0.16220371913164855\nbatch 200, loss 0.1733390137553215\nbatch 300, loss 0.1783679297566414\nbatch 400, loss 0.18232472941279412\nModel accuracy: 86.50%\nEnd of epoch 30\n-------------------------\nEpoch 31\nbatch 100, loss 0.16122045144438743\nbatch 200, loss 0.16560416162014008\nbatch 300, loss 0.17328639417886735\nbatch 400, loss 0.18381614863872528\nModel accuracy: 86.45%\nEnd of epoch 31\n-------------------------\nEpoch 32\nbatch 100, loss 0.15512956656515597\nbatch 200, loss 0.16755689322948455\nbatch 300, loss 0.16981551706790923\nbatch 400, loss 0.17737352006137372\nModel accuracy: 86.68%\nEnd of epoch 32\n-------------------------\nEpoch 33\nbatch 100, loss 0.15085506230592727\nbatch 200, loss 0.16914329260587693\nbatch 300, loss 0.16748904056847094\nbatch 400, loss 0.1761363573372364\nModel accuracy: 86.77%\nEnd of epoch 33\n-------------------------\nEpoch 34\nbatch 100, loss 0.1573239029198885\nbatch 200, loss 0.1623350628465414\nbatch 300, loss 0.1593898731470108\nbatch 400, loss 0.18208031319081783\nModel accuracy: 86.53%\nEnd of epoch 34\n-------------------------\nEpoch 35\nbatch 100, loss 0.14681999817490576\nbatch 200, loss 0.15299119487404822\nbatch 300, loss 0.15951380953192712\nbatch 400, loss 0.1789644856005907\nModel accuracy: 87.14%\nNew highest accuracy: 0.8714368939399719\nEnd of epoch 35\n-------------------------\nEpoch 36\nbatch 100, loss 0.13780128542333842\nbatch 200, loss 0.15104680247604846\nbatch 300, loss 0.16281914472579956\nbatch 400, loss 0.16415032714605332\nModel accuracy: 86.56%\nEnd of epoch 36\n-------------------------\nEpoch 37\nbatch 100, loss 0.14140414912253618\nbatch 200, loss 0.14879427693784236\nbatch 300, loss 0.15043172776699065\nbatch 400, loss 0.16124424047768116\nModel accuracy: 86.65%\nEnd of epoch 37\n-------------------------\nEpoch 38\nbatch 100, loss 0.13963917940855025\nbatch 200, loss 0.14696975976228713\nbatch 300, loss 0.1498751526325941\nbatch 400, loss 0.16724546425044537\nModel accuracy: 86.50%\nEnd of epoch 38\n-------------------------\nEpoch 39\nbatch 100, loss 0.14469791296869516\nbatch 200, loss 0.14637224573642016\nbatch 300, loss 0.1623458718508482\nbatch 400, loss 0.15424846913665533\nModel accuracy: 86.68%\nEnd of epoch 39\n-------------------------\nEpoch 40\nbatch 100, loss 0.13476959645748138\nbatch 200, loss 0.14432808820158244\nbatch 300, loss 0.1522339789569378\nbatch 400, loss 0.15014691196382046\nModel accuracy: 86.07%\nEnd of epoch 40\n-------------------------\nEpoch 41\nbatch 100, loss 0.140174614302814\nbatch 200, loss 0.1508945333212614\nbatch 300, loss 0.15196941532194613\nbatch 400, loss 0.1483056141063571\nModel accuracy: 87.23%\nNew highest accuracy: 0.8723095059394836\nEnd of epoch 41\n-------------------------\nEpoch 42\nbatch 100, loss 0.13751666147261857\nbatch 200, loss 0.139865167029202\nbatch 300, loss 0.1380647499859333\nbatch 400, loss 0.1476748574525118\nModel accuracy: 86.97%\nEnd of epoch 42\n-------------------------\nEpoch 43\nbatch 100, loss 0.13006325714290143\nbatch 200, loss 0.1424691466242075\nbatch 300, loss 0.1392911682650447\nbatch 400, loss 0.14881628528237342\nModel accuracy: 86.91%\nEnd of epoch 43\n-------------------------\nEpoch 44\nbatch 100, loss 0.1238890501484275\nbatch 200, loss 0.137397523149848\nbatch 300, loss 0.13997289538383484\nbatch 400, loss 0.15086022712290287\nModel accuracy: 86.62%\nEnd of epoch 44\n-------------------------\nEpoch 45\nbatch 100, loss 0.1351698400080204\nbatch 200, loss 0.13414906188845635\nbatch 300, loss 0.1385753569379449\nbatch 400, loss 0.1407256292924285\nModel accuracy: 87.00%\nEnd of epoch 45\n-------------------------\nEpoch 46\nbatch 100, loss 0.12339191194623708\nbatch 200, loss 0.13611533541232348\nbatch 300, loss 0.14306778989732266\nbatch 400, loss 0.1465745335072279\nModel accuracy: 86.39%\nEnd of epoch 46\n-------------------------\nEpoch 47\nbatch 100, loss 0.1267332899570465\nbatch 200, loss 0.13155565716326237\nbatch 300, loss 0.13074469082057477\nbatch 400, loss 0.14163539059460162\nModel accuracy: 86.79%\nEnd of epoch 47\n-------------------------\nEpoch 48\nbatch 100, loss 0.12001773077994585\nbatch 200, loss 0.13302614204585553\nbatch 300, loss 0.14182888820767403\nbatch 400, loss 0.13658559188246727\nModel accuracy: 86.56%\nEnd of epoch 48\n-------------------------\nEpoch 49\nbatch 100, loss 0.12255903270095586\nbatch 200, loss 0.12362348977476359\nbatch 300, loss 0.1345749046653509\nbatch 400, loss 0.139198206178844\nModel accuracy: 87.03%\nEnd of epoch 49\n-------------------------\nEpoch 50\nbatch 100, loss 0.11813947290182114\nbatch 200, loss 0.13258680544793605\nbatch 300, loss 0.1362661897391081\nbatch 400, loss 0.14307982981204986\nModel accuracy: 86.77%\nEnd of epoch 50\n-------------------------\nEpoch 51\nbatch 100, loss 0.11312606774270534\nbatch 200, loss 0.13347773265093565\nbatch 300, loss 0.1291982262581587\nbatch 400, loss 0.1381356829404831\nModel accuracy: 86.62%\nEnd of epoch 51\n-------------------------\nEpoch 52\nbatch 100, loss 0.11617817420512438\nbatch 200, loss 0.12462763722985983\nbatch 300, loss 0.13041483018547295\nbatch 400, loss 0.13594958994537593\nModel accuracy: 86.39%\nEnd of epoch 52\n-------------------------\nEpoch 53\nbatch 100, loss 0.11495684150606394\nbatch 200, loss 0.12233315281569958\nbatch 300, loss 0.12879078544676303\nbatch 400, loss 0.13400998651981355\nModel accuracy: 86.74%\nEnd of epoch 53\n-------------------------\nEpoch 54\nbatch 100, loss 0.11334789831191301\nbatch 200, loss 0.12377498582005501\nbatch 300, loss 0.13191846806555987\nbatch 400, loss 0.1272725586593151\nModel accuracy: 87.11%\nEnd of epoch 54\n-------------------------\nEpoch 55\nbatch 100, loss 0.11219710145145655\nbatch 200, loss 0.11760351460427046\nbatch 300, loss 0.13237097259610892\nbatch 400, loss 0.13496288113296032\nModel accuracy: 87.26%\nNew highest accuracy: 0.8726003766059875\nEnd of epoch 55\n-------------------------\nEpoch 56\nbatch 100, loss 0.11166935112327338\nbatch 200, loss 0.11971858706325293\nbatch 300, loss 0.1202097450196743\nbatch 400, loss 0.12764150727540255\nModel accuracy: 86.36%\nEnd of epoch 56\n-------------------------\nEpoch 57\nbatch 100, loss 0.10257240902632475\nbatch 200, loss 0.11765343647450209\nbatch 300, loss 0.11703212883323431\nbatch 400, loss 0.12566446259617806\nModel accuracy: 87.52%\nNew highest accuracy: 0.8752182126045227\nEnd of epoch 57\n-------------------------\nEpoch 58\nbatch 100, loss 0.10790527418255806\nbatch 200, loss 0.12074193950742483\nbatch 300, loss 0.12469904065132141\nbatch 400, loss 0.1278570229932666\nModel accuracy: 86.45%\nEnd of epoch 58\n-------------------------\nEpoch 59\nbatch 100, loss 0.10504985239356757\nbatch 200, loss 0.11492413766682148\nbatch 300, loss 0.12118184957653284\nbatch 400, loss 0.13197467107325792\nModel accuracy: 86.82%\nEnd of epoch 59\n-------------------------\nEpoch 60\nbatch 100, loss 0.10825933616608381\nbatch 200, loss 0.11681649874895811\nbatch 300, loss 0.11647801648825407\nbatch 400, loss 0.13008976448327303\nModel accuracy: 87.20%\nEnd of epoch 60\n-------------------------\nEpoch 61\nbatch 100, loss 0.10180965416133404\nbatch 200, loss 0.11671413134783507\nbatch 300, loss 0.11545869991183282\nbatch 400, loss 0.12630713261663915\nModel accuracy: 87.58%\nNew highest accuracy: 0.8757998943328857\nEnd of epoch 61\n-------------------------\nEpoch 62\nbatch 100, loss 0.10995391804724931\nbatch 200, loss 0.10986792344599962\nbatch 300, loss 0.11852037061005831\nbatch 400, loss 0.12597699865698814\nModel accuracy: 87.55%\nEnd of epoch 62\n-------------------------\nEpoch 63\nbatch 100, loss 0.10668433804064989\nbatch 200, loss 0.1098334052413702\nbatch 300, loss 0.12044183690100908\nbatch 400, loss 0.1158076674491167\nModel accuracy: 87.43%\nEnd of epoch 63\n-------------------------\nEpoch 64\nbatch 100, loss 0.10601182598620654\nbatch 200, loss 0.1097069663926959\nbatch 300, loss 0.11127791944891215\nbatch 400, loss 0.12495768345892429\nModel accuracy: 87.49%\nEnd of epoch 64\n-------------------------\nEpoch 65\nbatch 100, loss 0.10043533198535443\nbatch 200, loss 0.110718375146389\nbatch 300, loss 0.11771305467933417\nbatch 400, loss 0.12339903887361288\nModel accuracy: 87.09%\nEnd of epoch 65\n-------------------------\nEpoch 66\nbatch 100, loss 0.09939460391178727\nbatch 200, loss 0.1144513813778758\nbatch 300, loss 0.1066908597573638\nbatch 400, loss 0.11124557465314865\nModel accuracy: 87.32%\nEnd of epoch 66\n-------------------------\nEpoch 67\nbatch 100, loss 0.10762397821992636\nbatch 200, loss 0.10650279968976975\nbatch 300, loss 0.10767663531005382\nbatch 400, loss 0.11479169704020023\nModel accuracy: 87.14%\nEnd of epoch 67\n-------------------------\nEpoch 68\nbatch 100, loss 0.10010240273550153\nbatch 200, loss 0.10536838762462139\nbatch 300, loss 0.11181689091026784\nbatch 400, loss 0.12067786559462547\nModel accuracy: 87.58%\nEnd of epoch 68\n-------------------------\nEpoch 69\nbatch 100, loss 0.0952544462122023\nbatch 200, loss 0.11155086569488049\nbatch 300, loss 0.11455501675605774\nbatch 400, loss 0.11072668544948101\nModel accuracy: 86.88%\nEnd of epoch 69\n-------------------------\nEpoch 70\nbatch 100, loss 0.0936788029782474\nbatch 200, loss 0.10011235978454351\nbatch 300, loss 0.10793911900371313\nbatch 400, loss 0.11547569010406733\nModel accuracy: 87.11%\nEnd of epoch 70\n-------------------------\nEpoch 71\nbatch 100, loss 0.10421726990491152\nbatch 200, loss 0.10555256571620703\nbatch 300, loss 0.11177353248000145\nbatch 400, loss 0.1156128654256463\nModel accuracy: 87.17%\nEnd of epoch 71\n-------------------------\nEpoch 72\nbatch 100, loss 0.1049131329357624\nbatch 200, loss 0.10579334639012813\nbatch 300, loss 0.1120777241513133\nbatch 400, loss 0.1117202722094953\nModel accuracy: 87.75%\nNew highest accuracy: 0.8775451183319092\nEnd of epoch 72\n-------------------------\nEpoch 73\nbatch 100, loss 0.09633252434432507\nbatch 200, loss 0.10547576978802681\nbatch 300, loss 0.1073480474203825\nbatch 400, loss 0.11320575729012489\nModel accuracy: 87.49%\nEnd of epoch 73\n-------------------------\nEpoch 74\nbatch 100, loss 0.09525072108954191\nbatch 200, loss 0.10154122976586223\nbatch 300, loss 0.10131758511066437\nbatch 400, loss 0.11673280103132129\nModel accuracy: 87.70%\nEnd of epoch 74\n-------------------------\nEpoch 75\nbatch 100, loss 0.09710830971598625\nbatch 200, loss 0.09735006069764494\nbatch 300, loss 0.10233162555843592\nbatch 400, loss 0.11405609011650085\nModel accuracy: 87.32%\nEnd of epoch 75\n-------------------------\nEpoch 76\nbatch 100, loss 0.09434206038713455\nbatch 200, loss 0.10505881786346435\nbatch 300, loss 0.11231484092772007\nbatch 400, loss 0.10525997526943684\nModel accuracy: 86.65%\nEnd of epoch 76\n-------------------------\nEpoch 77\nbatch 100, loss 0.0943560291454196\nbatch 200, loss 0.10224988359957933\nbatch 300, loss 0.10538167864084244\nbatch 400, loss 0.096354298312217\nModel accuracy: 86.97%\nEnd of epoch 77\n-------------------------\nEpoch 78\nbatch 100, loss 0.09480333685874939\nbatch 200, loss 0.0944455861672759\nbatch 300, loss 0.10802934501320123\nbatch 400, loss 0.10488686054944991\nModel accuracy: 87.23%\nEnd of epoch 78\n-------------------------\nEpoch 79\nbatch 100, loss 0.0941369539871812\nbatch 200, loss 0.09605370812118054\nbatch 300, loss 0.10392073981463909\nbatch 400, loss 0.11097734656184911\nModel accuracy: 87.26%\nEnd of epoch 79\n-------------------------\nEpoch 80\nbatch 100, loss 0.08992297133430839\nbatch 200, loss 0.09761941272765398\nbatch 300, loss 0.10265288643538951\nbatch 400, loss 0.10450071014463902\nModel accuracy: 87.32%\nEnd of epoch 80\n-------------------------\nEpoch 81\nbatch 100, loss 0.09164213659241796\nbatch 200, loss 0.09774349711835384\nbatch 300, loss 0.09652327008545399\nbatch 400, loss 0.11365355037152768\nModel accuracy: 87.14%\nEnd of epoch 81\n-------------------------\nEpoch 82\nbatch 100, loss 0.09872948873788118\nbatch 200, loss 0.09633034691214562\nbatch 300, loss 0.10720755336806179\nbatch 400, loss 0.10877235535532236\nModel accuracy: 87.29%\nEnd of epoch 82\n-------------------------\nEpoch 83\nbatch 100, loss 0.08615791471675038\nbatch 200, loss 0.0969615351781249\nbatch 300, loss 0.10451982267200947\nbatch 400, loss 0.10347757913172245\nModel accuracy: 87.35%\nEnd of epoch 83\n-------------------------\nEpoch 84\nbatch 100, loss 0.09008787389844657\nbatch 200, loss 0.09931891463696957\nbatch 300, loss 0.10183713119477034\nbatch 400, loss 0.10709619529545307\nModel accuracy: 87.46%\nEnd of epoch 84\n-------------------------\nEpoch 85\nbatch 100, loss 0.08623319059610367\nbatch 200, loss 0.0981818121112883\nbatch 300, loss 0.09549403263255954\nbatch 400, loss 0.10199526280164718\nModel accuracy: 87.32%\nEnd of epoch 85\n-------------------------\nEpoch 86\nbatch 100, loss 0.08751846086233854\nbatch 200, loss 0.10378085581585765\nbatch 300, loss 0.09046246636658907\nbatch 400, loss 0.09905910003930331\nModel accuracy: 87.67%\nEnd of epoch 86\n-------------------------\nEpoch 87\nbatch 100, loss 0.08956490609794855\nbatch 200, loss 0.09870004137977957\nbatch 300, loss 0.09708821553736925\nbatch 400, loss 0.10178605049848556\nModel accuracy: 87.09%\nEnd of epoch 87\n-------------------------\nEpoch 88\nbatch 100, loss 0.08944101119413972\nbatch 200, loss 0.0936494743078947\nbatch 300, loss 0.09616516340523958\nbatch 400, loss 0.10267581447958946\nModel accuracy: 87.67%\nEnd of epoch 88\n-------------------------\nEpoch 89\nbatch 100, loss 0.0885039086639881\nbatch 200, loss 0.09610162362456322\nbatch 300, loss 0.09747009973973036\nbatch 400, loss 0.10595266478136182\nModel accuracy: 87.41%\nEnd of epoch 89\n-------------------------\nEpoch 90\nbatch 100, loss 0.0770477294549346\nbatch 200, loss 0.099730328284204\nbatch 300, loss 0.09587829411029816\nbatch 400, loss 0.09603298252448439\nModel accuracy: 87.78%\nNew highest accuracy: 0.8778359889984131\nEnd of epoch 90\n-------------------------\nEpoch 91\nbatch 100, loss 0.08408609050326049\nbatch 200, loss 0.09370174456387759\nbatch 300, loss 0.0966075786575675\nbatch 400, loss 0.09802194258198142\nModel accuracy: 87.41%\nEnd of epoch 91\n-------------------------\nEpoch 92\nbatch 100, loss 0.08376560196280479\nbatch 200, loss 0.09021430224180221\nbatch 300, loss 0.09928188558667898\nbatch 400, loss 0.09303318437188864\nModel accuracy: 87.52%\nEnd of epoch 92\n-------------------------\nEpoch 93\nbatch 100, loss 0.0883931003883481\nbatch 200, loss 0.08799420539289712\nbatch 300, loss 0.0944927965849638\nbatch 400, loss 0.0985324920155108\nModel accuracy: 87.64%\nEnd of epoch 93\n-------------------------\nEpoch 94\nbatch 100, loss 0.08059066124260425\nbatch 200, loss 0.08742215245962143\nbatch 300, loss 0.08818385323509574\nbatch 400, loss 0.09771269951015711\nModel accuracy: 87.75%\nEnd of epoch 94\n-------------------------\nEpoch 95\nbatch 100, loss 0.08617315959185362\nbatch 200, loss 0.09023557052016258\nbatch 300, loss 0.08764048373326659\nbatch 400, loss 0.09584249943494796\nModel accuracy: 87.26%\nEnd of epoch 95\n-------------------------\nEpoch 96\nbatch 100, loss 0.08249812372028828\nbatch 200, loss 0.08964972715824843\nbatch 300, loss 0.08927668014541268\nbatch 400, loss 0.09504545725882053\nModel accuracy: 87.09%\nEnd of epoch 96\n-------------------------\nEpoch 97\nbatch 100, loss 0.08657911265268922\nbatch 200, loss 0.08752006120979786\nbatch 300, loss 0.09831780819222331\nbatch 400, loss 0.09034885132685304\nModel accuracy: 87.29%\nEnd of epoch 97\n-------------------------\nEpoch 98\nbatch 100, loss 0.08336411898955703\nbatch 200, loss 0.08658858956769108\nbatch 300, loss 0.09285338137298822\nbatch 400, loss 0.09450048698112369\nModel accuracy: 86.94%\nEnd of epoch 98\n-------------------------\nEpoch 99\nbatch 100, loss 0.08213733604177832\nbatch 200, loss 0.09120012558996678\nbatch 300, loss 0.08984984505921602\nbatch 400, loss 0.10017645239830017\nModel accuracy: 87.11%\nEnd of epoch 99\n-------------------------\nEpoch 100\nbatch 100, loss 0.08137811250984668\nbatch 200, loss 0.08539615284651518\nbatch 300, loss 0.09137881260365248\nbatch 400, loss 0.09100246150046587\nModel accuracy: 87.46%\nEnd of epoch 100\n-------------------------\nEpoch 101\nbatch 100, loss 0.07930496525019408\nbatch 200, loss 0.08400334604084492\nbatch 300, loss 0.0855117904394865\nbatch 400, loss 0.09232061143964529\nModel accuracy: 87.38%\nEnd of epoch 101\n-------------------------\nEpoch 102\nbatch 100, loss 0.08289765767753124\nbatch 200, loss 0.08815545243211091\nbatch 300, loss 0.08829482391476631\nbatch 400, loss 0.09039539087563753\nModel accuracy: 87.23%\nEnd of epoch 102\n-------------------------\nEpoch 103\nbatch 100, loss 0.08119489477947354\nbatch 200, loss 0.08984118312597275\nbatch 300, loss 0.09681978680193425\nbatch 400, loss 0.08952074136584998\nModel accuracy: 86.85%\nEnd of epoch 103\n-------------------------\nEpoch 104\nbatch 100, loss 0.08111560147255659\nbatch 200, loss 0.0833469331637025\nbatch 300, loss 0.088416967689991\nbatch 400, loss 0.09031455351039767\nModel accuracy: 87.38%\nEnd of epoch 104\n-------------------------\nEpoch 105\nbatch 100, loss 0.07392966020852328\nbatch 200, loss 0.08815220635384322\nbatch 300, loss 0.08357393940910697\nbatch 400, loss 0.09532751824706792\nModel accuracy: 87.35%\nEnd of epoch 105\n-------------------------\nEpoch 106\nbatch 100, loss 0.07947631476446987\nbatch 200, loss 0.09054830428212882\nbatch 300, loss 0.0889788007363677\nbatch 400, loss 0.08650729153305292\nModel accuracy: 87.78%\nEnd of epoch 106\n-------------------------\nEpoch 107\nbatch 100, loss 0.08217606570571662\nbatch 200, loss 0.08046228423714638\nbatch 300, loss 0.08151343079283833\nbatch 400, loss 0.08912567749619484\nModel accuracy: 87.43%\nEnd of epoch 107\n-------------------------\nEpoch 108\nbatch 100, loss 0.08707285387441516\nbatch 200, loss 0.0808964579179883\nbatch 300, loss 0.08648431923240424\nbatch 400, loss 0.08845541972666979\nModel accuracy: 87.09%\nEnd of epoch 108\n-------------------------\nEpoch 109\nbatch 100, loss 0.07416098069399596\nbatch 200, loss 0.08108017161488533\nbatch 300, loss 0.08783580781891942\nbatch 400, loss 0.08868230246007443\nModel accuracy: 86.91%\nEnd of epoch 109\n-------------------------\nEpoch 110\nbatch 100, loss 0.08106791527941823\nbatch 200, loss 0.07800445534288883\nbatch 300, loss 0.08207052554003895\nbatch 400, loss 0.09356683790683747\nModel accuracy: 87.23%\nNo improvement in accuracy. Stopping early\n Best accuracy -> 0.8778359889984131\n","output_type":"stream"}]},{"cell_type":"code","source":"final_model = SimpleNet(embD=300).to(device)\nfinal_model.load_state_dict(torch.load(\"/kaggle/working/bestModel.pt\"))\nfinal_model.eval()\ny_pred = final_model(testSetXw, testSetXl)\ny_pred = torch.argmax(y_pred, dim=1)\nacc = (y_pred == testSetY).float().mean()\nacc = float(acc)\nprint(\"Final model accuracy: %.2f%%\" % (acc*100))","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:22:06.463712Z","iopub.execute_input":"2023-04-02T20:22:06.464069Z","iopub.status.idle":"2023-04-02T20:22:06.529205Z","shell.execute_reply.started":"2023-04-02T20:22:06.464037Z","shell.execute_reply":"2023-04-02T20:22:06.528197Z"},"trusted":true},"execution_count":170,"outputs":[{"name":"stdout","text":"Final model accuracy: 88.19%\n","output_type":"stream"}]},{"cell_type":"markdown","source":"best 80","metadata":{}},{"cell_type":"markdown","source":"## Submission","metadata":{}},{"cell_type":"code","source":"test = pd.read_csv(\"/kaggle/input/silero-stress-predictor/test.csv\")\ntest","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:22:09.524935Z","iopub.execute_input":"2023-04-02T20:22:09.525309Z","iopub.status.idle":"2023-04-02T20:22:09.577452Z","shell.execute_reply.started":"2023-04-02T20:22:09.525276Z","shell.execute_reply":"2023-04-02T20:22:09.576393Z"},"trusted":true},"execution_count":171,"outputs":[{"execution_count":171,"output_type":"execute_result","data":{"text/plain":" id word num_syllables lemma\n0 0 эпилепсия 5 эпилепсия\n1 1 относящейся 5 относиться\n2 2 размышлениями 6 размышление\n3 3 модемы 3 модем\n4 4 солнц 1 солнце\n... ... ... ... ...\n29955 29955 донбасса 3 донбасс\n29956 29956 обложка 3 обложка\n29957 29957 правителя 4 правитель\n29958 29958 шерстяной 3 шерстяной\n29959 29959 оптимизации 6 оптимизация\n\n[29960 rows x 4 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>id</th>\n <th>word</th>\n <th>num_syllables</th>\n <th>lemma</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0</td>\n <td>эпилепсия</td>\n <td>5</td>\n <td>эпилепсия</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n <td>относящейся</td>\n <td>5</td>\n <td>относиться</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2</td>\n <td>размышлениями</td>\n <td>6</td>\n <td>размышление</td>\n </tr>\n <tr>\n <th>3</th>\n <td>3</td>\n <td>модемы</td>\n <td>3</td>\n <td>модем</td>\n </tr>\n <tr>\n <th>4</th>\n <td>4</td>\n <td>солнц</td>\n <td>1</td>\n <td>солнце</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>29955</th>\n <td>29955</td>\n <td>донбасса</td>\n <td>3</td>\n <td>донбасс</td>\n </tr>\n <tr>\n <th>29956</th>\n <td>29956</td>\n <td>обложка</td>\n <td>3</td>\n <td>обложка</td>\n </tr>\n <tr>\n <th>29957</th>\n <td>29957</td>\n <td>правителя</td>\n <td>4</td>\n <td>правитель</td>\n </tr>\n <tr>\n <th>29958</th>\n <td>29958</td>\n <td>шерстяной</td>\n <td>3</td>\n <td>шерстяной</td>\n </tr>\n <tr>\n <th>29959</th>\n <td>29959</td>\n <td>оптимизации</td>\n <td>6</td>\n <td>оптимизация</td>\n </tr>\n </tbody>\n</table>\n<p>29960 rows × 4 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"testRxW = test[['word']].applymap(word2ind)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:24:20.985540Z","iopub.execute_input":"2023-04-02T20:24:20.986457Z","iopub.status.idle":"2023-04-02T20:24:21.352155Z","shell.execute_reply.started":"2023-04-02T20:24:20.986403Z","shell.execute_reply":"2023-04-02T20:24:21.351151Z"},"trusted":true},"execution_count":184,"outputs":[]},{"cell_type":"code","source":"wordsTS = pd.DataFrame(testRxW['word'].to_list(), columns = ['w1', 'w2', 'w3', 'w4', 'w5', 'w6'])\n\n# test_readyXGB = pd.concat([lemmasTS, wordsTS, test['num_syllables']], axis = 1)\n# test_readyXGB","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:24:35.214064Z","iopub.execute_input":"2023-04-02T20:24:35.214567Z","iopub.status.idle":"2023-04-02T20:24:35.303057Z","shell.execute_reply.started":"2023-04-02T20:24:35.214525Z","shell.execute_reply":"2023-04-02T20:24:35.302069Z"},"trusted":true},"execution_count":186,"outputs":[]},{"cell_type":"code","source":"SubTenzW = torch.tensor(wordsTS.values.astype(np.int32)).to(device)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:24:53.802897Z","iopub.execute_input":"2023-04-02T20:24:53.803294Z","iopub.status.idle":"2023-04-02T20:24:53.810269Z","shell.execute_reply.started":"2023-04-02T20:24:53.803260Z","shell.execute_reply":"2023-04-02T20:24:53.809243Z"},"trusted":true},"execution_count":187,"outputs":[]},{"cell_type":"code","source":"final_model.eval()\ny_pred = final_model(SubTenzW)\ny_pred = torch.argmax(y_pred, dim=1)\ny_pred","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:25:09.670327Z","iopub.execute_input":"2023-04-02T20:25:09.670910Z","iopub.status.idle":"2023-04-02T20:25:09.781638Z","shell.execute_reply.started":"2023-04-02T20:25:09.670874Z","shell.execute_reply":"2023-04-02T20:25:09.780716Z"},"trusted":true},"execution_count":188,"outputs":[{"execution_count":188,"output_type":"execute_result","data":{"text/plain":"tensor([2, 2, 2, ..., 1, 2, 3], device='cuda:0')"},"metadata":{}}]},{"cell_type":"code","source":"submPred = y_pred + 1","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:25:10.817185Z","iopub.execute_input":"2023-04-02T20:25:10.817555Z","iopub.status.idle":"2023-04-02T20:25:10.823092Z","shell.execute_reply.started":"2023-04-02T20:25:10.817521Z","shell.execute_reply":"2023-04-02T20:25:10.821839Z"},"trusted":true},"execution_count":189,"outputs":[]},{"cell_type":"code","source":"submPred","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:25:11.449844Z","iopub.execute_input":"2023-04-02T20:25:11.450548Z","iopub.status.idle":"2023-04-02T20:25:11.460170Z","shell.execute_reply.started":"2023-04-02T20:25:11.450508Z","shell.execute_reply":"2023-04-02T20:25:11.458954Z"},"trusted":true},"execution_count":190,"outputs":[{"execution_count":190,"output_type":"execute_result","data":{"text/plain":"tensor([3, 3, 3, ..., 2, 3, 4], device='cuda:0')"},"metadata":{}}]},{"cell_type":"code","source":"submSER = pd.Series(submPred.cpu(), name='stress')\nsubmDF = pd.concat([test['id'], submSER], axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:25:12.172001Z","iopub.execute_input":"2023-04-02T20:25:12.174437Z","iopub.status.idle":"2023-04-02T20:25:12.181093Z","shell.execute_reply.started":"2023-04-02T20:25:12.174388Z","shell.execute_reply":"2023-04-02T20:25:12.180086Z"},"trusted":true},"execution_count":191,"outputs":[]},{"cell_type":"code","source":"submDF","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:25:12.899001Z","iopub.execute_input":"2023-04-02T20:25:12.899674Z","iopub.status.idle":"2023-04-02T20:25:12.912010Z","shell.execute_reply.started":"2023-04-02T20:25:12.899638Z","shell.execute_reply":"2023-04-02T20:25:12.910792Z"},"trusted":true},"execution_count":192,"outputs":[{"execution_count":192,"output_type":"execute_result","data":{"text/plain":" id stress\n0 0 3\n1 1 3\n2 2 3\n3 3 2\n4 4 1\n... ... ...\n29955 29955 2\n29956 29956 2\n29957 29957 2\n29958 29958 3\n29959 29959 4\n\n[29960 rows x 2 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>id</th>\n <th>stress</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0</td>\n <td>3</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n <td>3</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>3</th>\n <td>3</td>\n <td>2</td>\n </tr>\n <tr>\n <th>4</th>\n <td>4</td>\n <td>1</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>29955</th>\n <td>29955</td>\n <td>2</td>\n </tr>\n <tr>\n <th>29956</th>\n <td>29956</td>\n <td>2</td>\n </tr>\n <tr>\n <th>29957</th>\n <td>29957</td>\n <td>2</td>\n </tr>\n <tr>\n <th>29958</th>\n <td>29958</td>\n <td>3</td>\n </tr>\n <tr>\n <th>29959</th>\n <td>29959</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n<p>29960 rows × 2 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"submDF.to_csv(\"submission_IvanovNN10.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2023-04-02T20:25:19.205310Z","iopub.execute_input":"2023-04-02T20:25:19.205682Z","iopub.status.idle":"2023-04-02T20:25:19.238917Z","shell.execute_reply.started":"2023-04-02T20:25:19.205648Z","shell.execute_reply":"2023-04-02T20:25:19.237948Z"},"trusted":true},"execution_count":194,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment