From 97dc77aacf4afb33e13b0bdbe3f79128bd32078f Mon Sep 17 00:00:00 2001 From: Arthur BATEL <arthur.batel@insa-lyon.fr> Date: Thu, 15 Feb 2024 17:38:05 +0100 Subject: [PATCH] Explainations --- Experiments.ipynb | 97 ++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 52 deletions(-) diff --git a/Experiments.ipynb b/Experiments.ipynb index 37bf511..8e52a6f 100644 --- a/Experiments.ipynb +++ b/Experiments.ipynb @@ -22,9 +22,9 @@ "source": [ "## Table 2 and 3: compute ACC, AUC and RMSE and DOA\n", "\n", - "Warning : can be long to compute\n", - "Prerequisite : Running the makefile\n", - "Output : stored in `../../results/table_2`" + "**Warning** : can be long to compute\n", + "**Prerequisite** : Running the makefile\n", + "**Output** : stored in `../../results/table_2`" ], "metadata": { "collapsed": false @@ -48,7 +48,15 @@ { "cell_type": "markdown", "source": [ - "## Table 3: compute DOA" + "## Table 3: compute DOA\n", + "\n", + "**Warning** : can be long to compute\n", + "**Prerequisite** : Running the makefile\n", + "**Output** : printed in the notebook\n", + "\n", + "The doa metrics are computed for the dataset whose index is specified by the variable `i`, for CD-BPR and for all competitors simultaneously, and for each data splitting of the cross validation.\n", + "\n", + "The embeddings are given pre-computed in the `result` directory. However, for the sake of reproducibility, they will be overwritten by the ones computed in the previous cell. " ], "metadata": { "collapsed": false @@ -62,35 +70,31 @@ "name": "stdout", "output_type": "stream", "text": [ - "_create_directory() - handled error when creating a directory at ../experiments_logs/3: [Errno 17] File exists: '../experiments_logs/3'\r\n", "dataset math_1\r\n", "fold 0\r\n", "model DINA\r\n", + "num_kc 11\r\n", + "model MCD\r\n", + "num_kc 11\r\n", + "model NCDM\r\n", + "num_kc 11\r\n", + "model MIRT\r\n", + "num_kc 11\r\n", + "model BPR\r\n", + "num_kc 11\r\n", + "fold 1\r\n", + "model DINA\r\n", + "num_kc 11\r\n", + "model MCD\r\n", + "num_kc 11\r\n", + "model NCDM\r\n", + "num_kc 11\r\n", "^C\r\n", "Traceback (most recent call last):\r\n", - " File \"/home/arthurb/Programmation/cd-bpr/code/./DOA.py\", line 161, in <module>\r\n", - " exp.train_test_split(dataset_name, test_proportion=0.2, valid_proportion=0.2, n_folds=5, i_fold=i_fold)\r\n", - " File \"/home/arthurb/Programmation/cd-bpr/code/utility/DatasetProcessor.py\", line 938, in train_test_split\r\n", - " self.test_steps[dataset_name] = self.get_test_dataset(dataset_name=dataset_name)['train_valid_log_nb'].to_numpy().astype(int)\r\n", - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/Programmation/cd-bpr/code/utility/DatasetProcessor.py\", line 1416, in get_test_dataset\r\n", - " return self.datasets[dataset_name][self.datasets[dataset_name]['split']=='test']\r\n", - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/pandas/core/ops/common.py\", line 76, in new_method\r\n", - " return method(self, other)\r\n", - " ^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/pandas/core/arraylike.py\", line 40, in __eq__\r\n", - " return self._cmp_method(other, operator.eq)\r\n", - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/pandas/core/series.py\", line 5803, in _cmp_method\r\n", - " res_values = ops.comparison_op(lvalues, rvalues, op)\r\n", - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/pandas/core/ops/array_ops.py\", line 346, in comparison_op\r\n", - " res_values = comp_method_OBJECT_ARRAY(op, lvalues, rvalues)\r\n", - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/pandas/core/ops/array_ops.py\", line 131, in comp_method_OBJECT_ARRAY\r\n", - " result = libops.scalar_compare(x.ravel(), y, op)\r\n", - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", + " File \"/home/arthurb/Programmation/cd-bpr/code/./DOA.py\", line 185, in <module>\r\n", + " r_train = dao_creuse(F, kc_user, kc_user_val, dico_u)\r\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", + " File \"/home/arthurb/Programmation/cd-bpr/code/./DOA.py\", line -1, in dao_creuse\r\n", "KeyboardInterrupt\r\n" ] } @@ -107,12 +111,12 @@ "metadata": { "collapsed": false, "ExecuteTime": { - "end_time": "2024-02-15T15:25:00.814018170Z", - "start_time": "2024-02-15T15:24:53.134103941Z" + "end_time": "2024-02-15T16:21:51.656146352Z", + "start_time": "2024-02-15T15:49:46.331839222Z" } }, "id": "68a2dc1287b5cac", - "execution_count": 7 + "execution_count": 18 }, { "cell_type": "markdown", @@ -124,12 +128,12 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 19, "id": "a9e32954", "metadata": { "ExecuteTime": { - "end_time": "2024-02-15T15:24:35.092972342Z", - "start_time": "2024-02-15T15:24:06.236900058Z" + "end_time": "2024-02-15T16:22:26.443494416Z", + "start_time": "2024-02-15T16:22:01.974704182Z" } }, "outputs": [ @@ -140,26 +144,15 @@ "Ablation (0 no ablation, 1 ablation L2, 2 ablation init, 3 both) 0\r\n", "assist0910_tkde\r\n", "NB (question-answer) in the data 17283\r\n", - "Epoch 1, Loss: 1.37166428565979\r\n", + "Epoch 1, Loss: 1.3824448585510254\r\n", "^C\r\n", "Traceback (most recent call last):\r\n", " File \"/home/arthurb/Programmation/cd-bpr/code/binary_bpr_ablation/main.py\", line 219, in <module>\r\n", " acc = bpr_model.train(train, len(dico_kc), epochs, batch_size, y_train, ablation)\r\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/Programmation/cd-bpr/code/binary_bpr_ablation/BPR_model.py\", line 105, in train\r\n", - " self.optimizer.step()\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/torch/optim/optimizer.py\", line 385, in wrapper\r\n", - " out = func(*args, **kwargs)\r\n", - " ^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/torch/optim/optimizer.py\", line 76, in _use_grad\r\n", - " ret = func(self, *args, **kwargs)\r\n", - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/torch/optim/adam.py\", line 166, in step\r\n", - " adam(\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/torch/optim/adam.py\", line 316, in adam\r\n", - " func(params,\r\n", - " File \"/home/arthurb/anaconda3/envs/cdbpr-env/lib/python3.11/site-packages/torch/optim/adam.py\", line 391, in _single_tensor_adam\r\n", - " exp_avg.lerp_(grad, 1 - beta1)\r\n", + " File \"/home/arthurb/Programmation/cd-bpr/code/binary_bpr_ablation/BPR_model.py\", line 99, in train\r\n", + " comp = comp.cpu()\r\n", + " ^^^^^^^^^^\r\n", "KeyboardInterrupt\r\n" ] } @@ -180,12 +173,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 20, "id": "e46ff5d4", "metadata": { "ExecuteTime": { - "end_time": "2024-02-15T15:25:07.559037819Z", - "start_time": "2024-02-15T15:25:07.001579876Z" + "end_time": "2024-02-15T16:22:29.824107304Z", + "start_time": "2024-02-15T16:22:29.286318951Z" } }, "outputs": [ -- GitLab