diff --git a/P3. k-nearest neighbours.ipynb b/P3. k-nearest neighbours.ipynb
index a15592c..55a3ee7 100644
--- a/P3. k-nearest neighbours.ipynb
+++ b/P3. k-nearest neighbours.ipynb
@@ -113,7 +113,7 @@
"text/plain": [
"array([[3, 4, 0, 0, 5, 0, 0, 4],\n",
" [0, 1, 2, 3, 0, 0, 0, 0],\n",
- " [0, 0, 0, 5, 0, 3, 4, 0]])"
+ " [0, 0, 0, 5, 0, 3, 4, 0]], dtype=int64)"
]
},
"metadata": {},
@@ -256,7 +256,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
- "943it [00:00, 9004.71it/s]\n"
+ "943it [00:00, 9914.99it/s]\n"
]
},
{
@@ -293,6 +293,8 @@
"
MRR | \n",
" LAUC | \n",
" HR | \n",
+ " HitRate2 | \n",
+ " HitRate3 | \n",
" Reco in test | \n",
" Test coverage | \n",
" Shannon | \n",
@@ -315,6 +317,8 @@
" 0.000368 | \n",
" 0.496391 | \n",
" 0.003181 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
" 0.392153 | \n",
" 0.11544 | \n",
" 4.174741 | \n",
@@ -331,8 +335,11 @@
" precision_super recall_super NDCG mAP MRR LAUC \\\n",
"0 0.0 0.0 0.000214 0.000037 0.000368 0.496391 \n",
"\n",
- " HR Reco in test Test coverage Shannon Gini \n",
- "0 0.003181 0.392153 0.11544 4.174741 0.965327 "
+ " HR HitRate2 HitRate3 Reco in test Test coverage Shannon \\\n",
+ "0 0.003181 0.0 0.0 0.392153 0.11544 4.174741 \n",
+ "\n",
+ " Gini \n",
+ "0 0.965327 "
]
},
"execution_count": 5,
@@ -365,12 +372,15 @@
"name": "stderr",
"output_type": "stream",
"text": [
- "943it [00:00, 8517.83it/s]\n",
- "943it [00:00, 11438.64it/s]\n",
- "943it [00:00, 11933.36it/s]\n",
- "943it [00:00, 10307.81it/s]\n",
- "943it [00:00, 12250.41it/s]\n",
- "943it [00:00, 12064.07it/s]\n"
+ "943it [00:00, 9928.75it/s]\n",
+ "943it [00:00, 10480.56it/s]\n",
+ "943it [00:00, 8591.71it/s]\n",
+ "943it [00:00, 9949.81it/s]\n",
+ "943it [00:00, 9925.57it/s]\n",
+ "943it [00:00, 9911.02it/s]\n",
+ "943it [00:00, 9196.77it/s]\n",
+ "943it [00:00, 9443.97it/s]\n",
+ "943it [00:00, 8577.83it/s]\n"
]
},
{
@@ -408,6 +418,8 @@
" MRR | \n",
" LAUC | \n",
" HR | \n",
+ " HitRate2 | \n",
+ " HitRate3 | \n",
" Reco in test | \n",
" Test coverage | \n",
" Shannon | \n",
@@ -431,6 +443,8 @@
" 0.400939 | \n",
" 0.555546 | \n",
" 0.765642 | \n",
+ " 0.492047 | \n",
+ " 0.290562 | \n",
" 1.000000 | \n",
" 0.038961 | \n",
" 3.159079 | \n",
@@ -452,6 +466,8 @@
" 0.198193 | \n",
" 0.515501 | \n",
" 0.437964 | \n",
+ " 0.239661 | \n",
+ " 0.126193 | \n",
" 1.000000 | \n",
" 0.033911 | \n",
" 2.836513 | \n",
@@ -460,23 +476,94 @@
" \n",
" 0 | \n",
" Ready_Random | \n",
- " 1.521845 | \n",
- " 1.225949 | \n",
- " 0.047190 | \n",
- " 0.020753 | \n",
- " 0.024810 | \n",
- " 0.032269 | \n",
- " 0.029506 | \n",
- " 0.023707 | \n",
- " 0.050075 | \n",
- " 0.018728 | \n",
- " 0.121957 | \n",
- " 0.506893 | \n",
- " 0.329799 | \n",
- " 0.986532 | \n",
- " 0.184704 | \n",
- " 5.099706 | \n",
- " 0.907217 | \n",
+ " 1.516512 | \n",
+ " 1.217214 | \n",
+ " 0.045599 | \n",
+ " 0.021001 | \n",
+ " 0.024136 | \n",
+ " 0.031226 | \n",
+ " 0.028541 | \n",
+ " 0.022057 | \n",
+ " 0.050154 | \n",
+ " 0.019000 | \n",
+ " 0.125089 | \n",
+ " 0.507013 | \n",
+ " 0.327678 | \n",
+ " 0.093319 | \n",
+ " 0.026511 | \n",
+ " 0.988017 | \n",
+ " 0.192641 | \n",
+ " 5.141246 | \n",
+ " 0.903763 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_I-KNN | \n",
+ " 1.030386 | \n",
+ " 0.813067 | \n",
+ " 0.026087 | \n",
+ " 0.006908 | \n",
+ " 0.010593 | \n",
+ " 0.016046 | \n",
+ " 0.021137 | \n",
+ " 0.009522 | \n",
+ " 0.024214 | \n",
+ " 0.008958 | \n",
+ " 0.048068 | \n",
+ " 0.499885 | \n",
+ " 0.154825 | \n",
+ " 0.072110 | \n",
+ " 0.024390 | \n",
+ " 0.402333 | \n",
+ " 0.434343 | \n",
+ " 5.133650 | \n",
+ " 0.877999 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_I-KNNBaseline | \n",
+ " 0.935327 | \n",
+ " 0.737424 | \n",
+ " 0.002545 | \n",
+ " 0.000755 | \n",
+ " 0.001105 | \n",
+ " 0.001602 | \n",
+ " 0.002253 | \n",
+ " 0.000930 | \n",
+ " 0.003444 | \n",
+ " 0.001362 | \n",
+ " 0.011760 | \n",
+ " 0.496724 | \n",
+ " 0.021209 | \n",
+ " 0.004242 | \n",
+ " 0.000000 | \n",
+ " 0.482821 | \n",
+ " 0.059885 | \n",
+ " 2.232578 | \n",
+ " 0.994487 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_U-KNN | \n",
+ " 1.023495 | \n",
+ " 0.807913 | \n",
+ " 0.000742 | \n",
+ " 0.000205 | \n",
+ " 0.000305 | \n",
+ " 0.000449 | \n",
+ " 0.000536 | \n",
+ " 0.000198 | \n",
+ " 0.000845 | \n",
+ " 0.000274 | \n",
+ " 0.002744 | \n",
+ " 0.496441 | \n",
+ " 0.007423 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.602121 | \n",
+ " 0.010823 | \n",
+ " 2.089186 | \n",
+ " 0.995706 | \n",
"
\n",
" \n",
" 0 | \n",
@@ -494,6 +581,8 @@
" 0.003348 | \n",
" 0.496433 | \n",
" 0.009544 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
" 0.699046 | \n",
" 0.005051 | \n",
" 1.945910 | \n",
@@ -515,6 +604,8 @@
" 0.001677 | \n",
" 0.496424 | \n",
" 0.009544 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
" 0.600530 | \n",
" 0.005051 | \n",
" 1.803126 | \n",
@@ -536,6 +627,8 @@
" 0.000368 | \n",
" 0.496391 | \n",
" 0.003181 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
" 0.392153 | \n",
" 0.115440 | \n",
" 4.174741 | \n",
@@ -546,29 +639,49 @@
""
],
"text/plain": [
- " Model RMSE MAE precision recall F_1 \\\n",
- "0 Self_TopPop 2.508258 2.217909 0.188865 0.116919 0.118732 \n",
- "0 Ready_Baseline 0.949459 0.752487 0.091410 0.037652 0.046030 \n",
- "0 Ready_Random 1.521845 1.225949 0.047190 0.020753 0.024810 \n",
- "0 Self_TopRated 1.030712 0.820904 0.000954 0.000188 0.000298 \n",
- "0 Self_BaselineUI 0.967585 0.762740 0.000954 0.000170 0.000278 \n",
- "0 Self_IKNN 1.018363 0.808793 0.000318 0.000108 0.000140 \n",
+ " Model RMSE MAE precision recall F_1 \\\n",
+ "0 Self_TopPop 2.508258 2.217909 0.188865 0.116919 0.118732 \n",
+ "0 Ready_Baseline 0.949459 0.752487 0.091410 0.037652 0.046030 \n",
+ "0 Ready_Random 1.516512 1.217214 0.045599 0.021001 0.024136 \n",
+ "0 Ready_I-KNN 1.030386 0.813067 0.026087 0.006908 0.010593 \n",
+ "0 Ready_I-KNNBaseline 0.935327 0.737424 0.002545 0.000755 0.001105 \n",
+ "0 Ready_U-KNN 1.023495 0.807913 0.000742 0.000205 0.000305 \n",
+ "0 Self_TopRated 1.030712 0.820904 0.000954 0.000188 0.000298 \n",
+ "0 Self_BaselineUI 0.967585 0.762740 0.000954 0.000170 0.000278 \n",
+ "0 Self_IKNN 1.018363 0.808793 0.000318 0.000108 0.000140 \n",
"\n",
" F_05 precision_super recall_super NDCG mAP MRR \\\n",
"0 0.141584 0.130472 0.137473 0.214651 0.111707 0.400939 \n",
"0 0.061286 0.079614 0.056463 0.095957 0.043178 0.198193 \n",
- "0 0.032269 0.029506 0.023707 0.050075 0.018728 0.121957 \n",
+ "0 0.031226 0.028541 0.022057 0.050154 0.019000 0.125089 \n",
+ "0 0.016046 0.021137 0.009522 0.024214 0.008958 0.048068 \n",
+ "0 0.001602 0.002253 0.000930 0.003444 0.001362 0.011760 \n",
+ "0 0.000449 0.000536 0.000198 0.000845 0.000274 0.002744 \n",
"0 0.000481 0.000644 0.000223 0.001043 0.000335 0.003348 \n",
"0 0.000463 0.000644 0.000189 0.000752 0.000168 0.001677 \n",
"0 0.000189 0.000000 0.000000 0.000214 0.000037 0.000368 \n",
"\n",
- " LAUC HR Reco in test Test coverage Shannon Gini \n",
- "0 0.555546 0.765642 1.000000 0.038961 3.159079 0.987317 \n",
- "0 0.515501 0.437964 1.000000 0.033911 2.836513 0.991139 \n",
- "0 0.506893 0.329799 0.986532 0.184704 5.099706 0.907217 \n",
- "0 0.496433 0.009544 0.699046 0.005051 1.945910 0.995669 \n",
- "0 0.496424 0.009544 0.600530 0.005051 1.803126 0.996380 \n",
- "0 0.496391 0.003181 0.392153 0.115440 4.174741 0.965327 "
+ " LAUC HR HitRate2 HitRate3 Reco in test Test coverage \\\n",
+ "0 0.555546 0.765642 0.492047 0.290562 1.000000 0.038961 \n",
+ "0 0.515501 0.437964 0.239661 0.126193 1.000000 0.033911 \n",
+ "0 0.507013 0.327678 0.093319 0.026511 0.988017 0.192641 \n",
+ "0 0.499885 0.154825 0.072110 0.024390 0.402333 0.434343 \n",
+ "0 0.496724 0.021209 0.004242 0.000000 0.482821 0.059885 \n",
+ "0 0.496441 0.007423 0.000000 0.000000 0.602121 0.010823 \n",
+ "0 0.496433 0.009544 0.000000 0.000000 0.699046 0.005051 \n",
+ "0 0.496424 0.009544 0.000000 0.000000 0.600530 0.005051 \n",
+ "0 0.496391 0.003181 0.000000 0.000000 0.392153 0.115440 \n",
+ "\n",
+ " Shannon Gini \n",
+ "0 3.159079 0.987317 \n",
+ "0 2.836513 0.991139 \n",
+ "0 5.141246 0.903763 \n",
+ "0 5.133650 0.877999 \n",
+ "0 2.232578 0.994487 \n",
+ "0 2.089186 0.995706 \n",
+ "0 1.945910 0.995669 \n",
+ "0 1.803126 0.996380 \n",
+ "0 4.174741 0.965327 "
]
},
"execution_count": 6,
@@ -718,15 +831,15 @@
"name": "stderr",
"output_type": "stream",
"text": [
- "943it [00:00, 11286.27it/s]\n",
- "943it [00:00, 10874.86it/s]\n",
- "943it [00:00, 11509.97it/s]\n",
- "943it [00:00, 11855.81it/s]\n",
- "943it [00:00, 11574.00it/s]\n",
- "943it [00:00, 11080.19it/s]\n",
- "943it [00:00, 11550.84it/s]\n",
- "943it [00:00, 12148.14it/s]\n",
- "943it [00:00, 10779.39it/s]\n"
+ "943it [00:00, 8051.57it/s]\n",
+ "943it [00:00, 9790.90it/s]\n",
+ "943it [00:00, 9404.38it/s]\n",
+ "943it [00:00, 9429.83it/s]\n",
+ "943it [00:00, 9915.86it/s]\n",
+ "943it [00:00, 8625.66it/s]\n",
+ "943it [00:00, 9687.63it/s]\n",
+ "943it [00:00, 10469.91it/s]\n",
+ "943it [00:00, 8577.63it/s]\n"
]
},
{
@@ -764,6 +877,8 @@
" MRR | \n",
" LAUC | \n",
" HR | \n",
+ " HitRate2 | \n",
+ " HitRate3 | \n",
" Reco in test | \n",
" Test coverage | \n",
" Shannon | \n",
@@ -787,6 +902,8 @@
" 0.400939 | \n",
" 0.555546 | \n",
" 0.765642 | \n",
+ " 0.492047 | \n",
+ " 0.290562 | \n",
" 1.000000 | \n",
" 0.038961 | \n",
" 3.159079 | \n",
@@ -808,6 +925,8 @@
" 0.198193 | \n",
" 0.515501 | \n",
" 0.437964 | \n",
+ " 0.239661 | \n",
+ " 0.126193 | \n",
" 1.000000 | \n",
" 0.033911 | \n",
" 2.836513 | \n",
@@ -816,23 +935,25 @@
"
\n",
" 0 | \n",
" Ready_Random | \n",
- " 1.521845 | \n",
- " 1.225949 | \n",
- " 0.047190 | \n",
- " 0.020753 | \n",
- " 0.024810 | \n",
- " 0.032269 | \n",
- " 0.029506 | \n",
- " 0.023707 | \n",
- " 0.050075 | \n",
- " 0.018728 | \n",
- " 0.121957 | \n",
- " 0.506893 | \n",
- " 0.329799 | \n",
- " 0.986532 | \n",
- " 0.184704 | \n",
- " 5.099706 | \n",
- " 0.907217 | \n",
+ " 1.516512 | \n",
+ " 1.217214 | \n",
+ " 0.045599 | \n",
+ " 0.021001 | \n",
+ " 0.024136 | \n",
+ " 0.031226 | \n",
+ " 0.028541 | \n",
+ " 0.022057 | \n",
+ " 0.050154 | \n",
+ " 0.019000 | \n",
+ " 0.125089 | \n",
+ " 0.507013 | \n",
+ " 0.327678 | \n",
+ " 0.093319 | \n",
+ " 0.026511 | \n",
+ " 0.988017 | \n",
+ " 0.192641 | \n",
+ " 5.141246 | \n",
+ " 0.903763 | \n",
"
\n",
" \n",
" 0 | \n",
@@ -850,6 +971,8 @@
" 0.048068 | \n",
" 0.499885 | \n",
" 0.154825 | \n",
+ " 0.072110 | \n",
+ " 0.024390 | \n",
" 0.402333 | \n",
" 0.434343 | \n",
" 5.133650 | \n",
@@ -871,6 +994,8 @@
" 0.011760 | \n",
" 0.496724 | \n",
" 0.021209 | \n",
+ " 0.004242 | \n",
+ " 0.000000 | \n",
" 0.482821 | \n",
" 0.059885 | \n",
" 2.232578 | \n",
@@ -892,6 +1017,8 @@
" 0.002744 | \n",
" 0.496441 | \n",
" 0.007423 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
" 0.602121 | \n",
" 0.010823 | \n",
" 2.089186 | \n",
@@ -913,6 +1040,8 @@
" 0.003348 | \n",
" 0.496433 | \n",
" 0.009544 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
" 0.699046 | \n",
" 0.005051 | \n",
" 1.945910 | \n",
@@ -934,6 +1063,8 @@
" 0.001677 | \n",
" 0.496424 | \n",
" 0.009544 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
" 0.600530 | \n",
" 0.005051 | \n",
" 1.803126 | \n",
@@ -955,6 +1086,8 @@
" 0.000368 | \n",
" 0.496391 | \n",
" 0.003181 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
" 0.392153 | \n",
" 0.115440 | \n",
" 4.174741 | \n",
@@ -968,7 +1101,7 @@
" Model RMSE MAE precision recall F_1 \\\n",
"0 Self_TopPop 2.508258 2.217909 0.188865 0.116919 0.118732 \n",
"0 Ready_Baseline 0.949459 0.752487 0.091410 0.037652 0.046030 \n",
- "0 Ready_Random 1.521845 1.225949 0.047190 0.020753 0.024810 \n",
+ "0 Ready_Random 1.516512 1.217214 0.045599 0.021001 0.024136 \n",
"0 Ready_I-KNN 1.030386 0.813067 0.026087 0.006908 0.010593 \n",
"0 Ready_I-KNNBaseline 0.935327 0.737424 0.002545 0.000755 0.001105 \n",
"0 Ready_U-KNN 1.023495 0.807913 0.000742 0.000205 0.000305 \n",
@@ -979,7 +1112,7 @@
" F_05 precision_super recall_super NDCG mAP MRR \\\n",
"0 0.141584 0.130472 0.137473 0.214651 0.111707 0.400939 \n",
"0 0.061286 0.079614 0.056463 0.095957 0.043178 0.198193 \n",
- "0 0.032269 0.029506 0.023707 0.050075 0.018728 0.121957 \n",
+ "0 0.031226 0.028541 0.022057 0.050154 0.019000 0.125089 \n",
"0 0.016046 0.021137 0.009522 0.024214 0.008958 0.048068 \n",
"0 0.001602 0.002253 0.000930 0.003444 0.001362 0.011760 \n",
"0 0.000449 0.000536 0.000198 0.000845 0.000274 0.002744 \n",
@@ -987,16 +1120,27 @@
"0 0.000463 0.000644 0.000189 0.000752 0.000168 0.001677 \n",
"0 0.000189 0.000000 0.000000 0.000214 0.000037 0.000368 \n",
"\n",
- " LAUC HR Reco in test Test coverage Shannon Gini \n",
- "0 0.555546 0.765642 1.000000 0.038961 3.159079 0.987317 \n",
- "0 0.515501 0.437964 1.000000 0.033911 2.836513 0.991139 \n",
- "0 0.506893 0.329799 0.986532 0.184704 5.099706 0.907217 \n",
- "0 0.499885 0.154825 0.402333 0.434343 5.133650 0.877999 \n",
- "0 0.496724 0.021209 0.482821 0.059885 2.232578 0.994487 \n",
- "0 0.496441 0.007423 0.602121 0.010823 2.089186 0.995706 \n",
- "0 0.496433 0.009544 0.699046 0.005051 1.945910 0.995669 \n",
- "0 0.496424 0.009544 0.600530 0.005051 1.803126 0.996380 \n",
- "0 0.496391 0.003181 0.392153 0.115440 4.174741 0.965327 "
+ " LAUC HR HitRate2 HitRate3 Reco in test Test coverage \\\n",
+ "0 0.555546 0.765642 0.492047 0.290562 1.000000 0.038961 \n",
+ "0 0.515501 0.437964 0.239661 0.126193 1.000000 0.033911 \n",
+ "0 0.507013 0.327678 0.093319 0.026511 0.988017 0.192641 \n",
+ "0 0.499885 0.154825 0.072110 0.024390 0.402333 0.434343 \n",
+ "0 0.496724 0.021209 0.004242 0.000000 0.482821 0.059885 \n",
+ "0 0.496441 0.007423 0.000000 0.000000 0.602121 0.010823 \n",
+ "0 0.496433 0.009544 0.000000 0.000000 0.699046 0.005051 \n",
+ "0 0.496424 0.009544 0.000000 0.000000 0.600530 0.005051 \n",
+ "0 0.496391 0.003181 0.000000 0.000000 0.392153 0.115440 \n",
+ "\n",
+ " Shannon Gini \n",
+ "0 3.159079 0.987317 \n",
+ "0 2.836513 0.991139 \n",
+ "0 5.141246 0.903763 \n",
+ "0 5.133650 0.877999 \n",
+ "0 2.232578 0.994487 \n",
+ "0 2.089186 0.995706 \n",
+ "0 1.945910 0.995669 \n",
+ "0 1.803126 0.996380 \n",
+ "0 4.174741 0.965327 "
]
},
"execution_count": 10,
@@ -1021,7 +1165,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1031,6 +1175,463 @@
"# please save the output in 'Recommendations generated/ml-100k/Self_KNNSurprisetask_reco.csv' and\n",
"# 'Recommendations generated/ml-100k/Self_KNNSurprisetask_estimations.csv'"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Estimating biases using als...\n",
+ "Computing the msd similarity matrix...\n",
+ "Done computing similarity matrix.\n",
+ "Generating predictions...\n",
+ "Generating top N recommendations...\n",
+ "Generating predictions...\n"
+ ]
+ }
+ ],
+ "source": [
+ "sim_options = {\n",
+ " \"name\": \"cosine\",\n",
+ " \"user_based\": True,\n",
+ "} # compute similarities between items\n",
+ "algorytm = sp.KNNBaseline(min_k=55, k=155)\n",
+ "\n",
+ "helpers.ready_made(\n",
+ " algorytm,\n",
+ " reco_path=\"Recommendations generated/ml-100k/Self_KNNSurprisetask_reco.csv\",\n",
+ " estimations_path=\"Recommendations generated/ml-100k/Self_KNNSurprisetask_estimations.csv\",\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "943it [00:00, 12777.10it/s]\n",
+ "943it [00:00, 13902.58it/s]\n",
+ "943it [00:00, 13703.41it/s]\n",
+ "943it [00:00, 12363.57it/s]\n",
+ "943it [00:00, 14321.56it/s]\n",
+ "943it [00:00, 13132.35it/s]\n",
+ "943it [00:00, 14318.76it/s]\n",
+ "943it [00:00, 11530.04it/s]\n",
+ "943it [00:00, 11255.60it/s]\n",
+ "943it [00:00, 12605.02it/s]\n",
+ "943it [00:00, 12946.27it/s]\n",
+ "943it [00:00, 12127.73it/s]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Model | \n",
+ " RMSE | \n",
+ " MAE | \n",
+ " precision | \n",
+ " recall | \n",
+ " F_1 | \n",
+ " F_05 | \n",
+ " precision_super | \n",
+ " recall_super | \n",
+ " NDCG | \n",
+ " mAP | \n",
+ " MRR | \n",
+ " LAUC | \n",
+ " HR | \n",
+ " HitRate2 | \n",
+ " HitRate3 | \n",
+ " Reco in test | \n",
+ " Test coverage | \n",
+ " Shannon | \n",
+ " Gini | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " Self_RP3Beta | \n",
+ " 3.501158 | \n",
+ " 3.321368 | \n",
+ " 0.315907 | \n",
+ " 0.213088 | \n",
+ " 0.208492 | \n",
+ " 0.242756 | \n",
+ " 0.233476 | \n",
+ " 0.270002 | \n",
+ " 0.382946 | \n",
+ " 0.245988 | \n",
+ " 0.626241 | \n",
+ " 0.604180 | \n",
+ " 0.896076 | \n",
+ " 0.727466 | \n",
+ " 0.538706 | \n",
+ " 1.000000 | \n",
+ " 0.122655 | \n",
+ " 4.342930 | \n",
+ " 0.959561 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Self_P3 | \n",
+ " 3.702446 | \n",
+ " 3.527273 | \n",
+ " 0.282185 | \n",
+ " 0.192092 | \n",
+ " 0.186749 | \n",
+ " 0.216980 | \n",
+ " 0.204185 | \n",
+ " 0.240096 | \n",
+ " 0.339114 | \n",
+ " 0.204905 | \n",
+ " 0.572157 | \n",
+ " 0.593544 | \n",
+ " 0.875928 | \n",
+ " 0.685048 | \n",
+ " 0.495228 | \n",
+ " 1.000000 | \n",
+ " 0.077201 | \n",
+ " 3.875892 | \n",
+ " 0.974947 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Self_TopPop | \n",
+ " 2.508258 | \n",
+ " 2.217909 | \n",
+ " 0.188865 | \n",
+ " 0.116919 | \n",
+ " 0.118732 | \n",
+ " 0.141584 | \n",
+ " 0.130472 | \n",
+ " 0.137473 | \n",
+ " 0.214651 | \n",
+ " 0.111707 | \n",
+ " 0.400939 | \n",
+ " 0.555546 | \n",
+ " 0.765642 | \n",
+ " 0.492047 | \n",
+ " 0.290562 | \n",
+ " 1.000000 | \n",
+ " 0.038961 | \n",
+ " 3.159079 | \n",
+ " 0.987317 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Self_KNNSurprisetask | \n",
+ " 0.942531 | \n",
+ " 0.744851 | \n",
+ " 0.090562 | \n",
+ " 0.038031 | \n",
+ " 0.045951 | \n",
+ " 0.060863 | \n",
+ " 0.080258 | \n",
+ " 0.058681 | \n",
+ " 0.090174 | \n",
+ " 0.038552 | \n",
+ " 0.178715 | \n",
+ " 0.515679 | \n",
+ " 0.448568 | \n",
+ " 0.232238 | \n",
+ " 0.123012 | \n",
+ " 1.000000 | \n",
+ " 0.042569 | \n",
+ " 3.015508 | \n",
+ " 0.989612 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_Baseline | \n",
+ " 0.949459 | \n",
+ " 0.752487 | \n",
+ " 0.091410 | \n",
+ " 0.037652 | \n",
+ " 0.046030 | \n",
+ " 0.061286 | \n",
+ " 0.079614 | \n",
+ " 0.056463 | \n",
+ " 0.095957 | \n",
+ " 0.043178 | \n",
+ " 0.198193 | \n",
+ " 0.515501 | \n",
+ " 0.437964 | \n",
+ " 0.239661 | \n",
+ " 0.126193 | \n",
+ " 1.000000 | \n",
+ " 0.033911 | \n",
+ " 2.836513 | \n",
+ " 0.991139 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_Random | \n",
+ " 1.516512 | \n",
+ " 1.217214 | \n",
+ " 0.045599 | \n",
+ " 0.021001 | \n",
+ " 0.024136 | \n",
+ " 0.031226 | \n",
+ " 0.028541 | \n",
+ " 0.022057 | \n",
+ " 0.050154 | \n",
+ " 0.019000 | \n",
+ " 0.125089 | \n",
+ " 0.507013 | \n",
+ " 0.327678 | \n",
+ " 0.093319 | \n",
+ " 0.026511 | \n",
+ " 0.988017 | \n",
+ " 0.192641 | \n",
+ " 5.141246 | \n",
+ " 0.903763 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_I-KNN | \n",
+ " 1.030386 | \n",
+ " 0.813067 | \n",
+ " 0.026087 | \n",
+ " 0.006908 | \n",
+ " 0.010593 | \n",
+ " 0.016046 | \n",
+ " 0.021137 | \n",
+ " 0.009522 | \n",
+ " 0.024214 | \n",
+ " 0.008958 | \n",
+ " 0.048068 | \n",
+ " 0.499885 | \n",
+ " 0.154825 | \n",
+ " 0.072110 | \n",
+ " 0.024390 | \n",
+ " 0.402333 | \n",
+ " 0.434343 | \n",
+ " 5.133650 | \n",
+ " 0.877999 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_I-KNNBaseline | \n",
+ " 0.935327 | \n",
+ " 0.737424 | \n",
+ " 0.002545 | \n",
+ " 0.000755 | \n",
+ " 0.001105 | \n",
+ " 0.001602 | \n",
+ " 0.002253 | \n",
+ " 0.000930 | \n",
+ " 0.003444 | \n",
+ " 0.001362 | \n",
+ " 0.011760 | \n",
+ " 0.496724 | \n",
+ " 0.021209 | \n",
+ " 0.004242 | \n",
+ " 0.000000 | \n",
+ " 0.482821 | \n",
+ " 0.059885 | \n",
+ " 2.232578 | \n",
+ " 0.994487 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Ready_U-KNN | \n",
+ " 1.023495 | \n",
+ " 0.807913 | \n",
+ " 0.000742 | \n",
+ " 0.000205 | \n",
+ " 0.000305 | \n",
+ " 0.000449 | \n",
+ " 0.000536 | \n",
+ " 0.000198 | \n",
+ " 0.000845 | \n",
+ " 0.000274 | \n",
+ " 0.002744 | \n",
+ " 0.496441 | \n",
+ " 0.007423 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.602121 | \n",
+ " 0.010823 | \n",
+ " 2.089186 | \n",
+ " 0.995706 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Self_TopRated | \n",
+ " 1.030712 | \n",
+ " 0.820904 | \n",
+ " 0.000954 | \n",
+ " 0.000188 | \n",
+ " 0.000298 | \n",
+ " 0.000481 | \n",
+ " 0.000644 | \n",
+ " 0.000223 | \n",
+ " 0.001043 | \n",
+ " 0.000335 | \n",
+ " 0.003348 | \n",
+ " 0.496433 | \n",
+ " 0.009544 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.699046 | \n",
+ " 0.005051 | \n",
+ " 1.945910 | \n",
+ " 0.995669 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Self_BaselineUI | \n",
+ " 0.967585 | \n",
+ " 0.762740 | \n",
+ " 0.000954 | \n",
+ " 0.000170 | \n",
+ " 0.000278 | \n",
+ " 0.000463 | \n",
+ " 0.000644 | \n",
+ " 0.000189 | \n",
+ " 0.000752 | \n",
+ " 0.000168 | \n",
+ " 0.001677 | \n",
+ " 0.496424 | \n",
+ " 0.009544 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.600530 | \n",
+ " 0.005051 | \n",
+ " 1.803126 | \n",
+ " 0.996380 | \n",
+ "
\n",
+ " \n",
+ " 0 | \n",
+ " Self_IKNN | \n",
+ " 1.018363 | \n",
+ " 0.808793 | \n",
+ " 0.000318 | \n",
+ " 0.000108 | \n",
+ " 0.000140 | \n",
+ " 0.000189 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.000214 | \n",
+ " 0.000037 | \n",
+ " 0.000368 | \n",
+ " 0.496391 | \n",
+ " 0.003181 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.392153 | \n",
+ " 0.115440 | \n",
+ " 4.174741 | \n",
+ " 0.965327 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Model RMSE MAE precision recall F_1 \\\n",
+ "0 Self_RP3Beta 3.501158 3.321368 0.315907 0.213088 0.208492 \n",
+ "0 Self_P3 3.702446 3.527273 0.282185 0.192092 0.186749 \n",
+ "0 Self_TopPop 2.508258 2.217909 0.188865 0.116919 0.118732 \n",
+ "0 Self_KNNSurprisetask 0.942531 0.744851 0.090562 0.038031 0.045951 \n",
+ "0 Ready_Baseline 0.949459 0.752487 0.091410 0.037652 0.046030 \n",
+ "0 Ready_Random 1.516512 1.217214 0.045599 0.021001 0.024136 \n",
+ "0 Ready_I-KNN 1.030386 0.813067 0.026087 0.006908 0.010593 \n",
+ "0 Ready_I-KNNBaseline 0.935327 0.737424 0.002545 0.000755 0.001105 \n",
+ "0 Ready_U-KNN 1.023495 0.807913 0.000742 0.000205 0.000305 \n",
+ "0 Self_TopRated 1.030712 0.820904 0.000954 0.000188 0.000298 \n",
+ "0 Self_BaselineUI 0.967585 0.762740 0.000954 0.000170 0.000278 \n",
+ "0 Self_IKNN 1.018363 0.808793 0.000318 0.000108 0.000140 \n",
+ "\n",
+ " F_05 precision_super recall_super NDCG mAP MRR \\\n",
+ "0 0.242756 0.233476 0.270002 0.382946 0.245988 0.626241 \n",
+ "0 0.216980 0.204185 0.240096 0.339114 0.204905 0.572157 \n",
+ "0 0.141584 0.130472 0.137473 0.214651 0.111707 0.400939 \n",
+ "0 0.060863 0.080258 0.058681 0.090174 0.038552 0.178715 \n",
+ "0 0.061286 0.079614 0.056463 0.095957 0.043178 0.198193 \n",
+ "0 0.031226 0.028541 0.022057 0.050154 0.019000 0.125089 \n",
+ "0 0.016046 0.021137 0.009522 0.024214 0.008958 0.048068 \n",
+ "0 0.001602 0.002253 0.000930 0.003444 0.001362 0.011760 \n",
+ "0 0.000449 0.000536 0.000198 0.000845 0.000274 0.002744 \n",
+ "0 0.000481 0.000644 0.000223 0.001043 0.000335 0.003348 \n",
+ "0 0.000463 0.000644 0.000189 0.000752 0.000168 0.001677 \n",
+ "0 0.000189 0.000000 0.000000 0.000214 0.000037 0.000368 \n",
+ "\n",
+ " LAUC HR HitRate2 HitRate3 Reco in test Test coverage \\\n",
+ "0 0.604180 0.896076 0.727466 0.538706 1.000000 0.122655 \n",
+ "0 0.593544 0.875928 0.685048 0.495228 1.000000 0.077201 \n",
+ "0 0.555546 0.765642 0.492047 0.290562 1.000000 0.038961 \n",
+ "0 0.515679 0.448568 0.232238 0.123012 1.000000 0.042569 \n",
+ "0 0.515501 0.437964 0.239661 0.126193 1.000000 0.033911 \n",
+ "0 0.507013 0.327678 0.093319 0.026511 0.988017 0.192641 \n",
+ "0 0.499885 0.154825 0.072110 0.024390 0.402333 0.434343 \n",
+ "0 0.496724 0.021209 0.004242 0.000000 0.482821 0.059885 \n",
+ "0 0.496441 0.007423 0.000000 0.000000 0.602121 0.010823 \n",
+ "0 0.496433 0.009544 0.000000 0.000000 0.699046 0.005051 \n",
+ "0 0.496424 0.009544 0.000000 0.000000 0.600530 0.005051 \n",
+ "0 0.496391 0.003181 0.000000 0.000000 0.392153 0.115440 \n",
+ "\n",
+ " Shannon Gini \n",
+ "0 4.342930 0.959561 \n",
+ "0 3.875892 0.974947 \n",
+ "0 3.159079 0.987317 \n",
+ "0 3.015508 0.989612 \n",
+ "0 2.836513 0.991139 \n",
+ "0 5.141246 0.903763 \n",
+ "0 5.133650 0.877999 \n",
+ "0 2.232578 0.994487 \n",
+ "0 2.089186 0.995706 \n",
+ "0 1.945910 0.995669 \n",
+ "0 1.803126 0.996380 \n",
+ "0 4.174741 0.965327 "
+ ]
+ },
+ "execution_count": 44,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "dir_path = \"Recommendations generated/ml-100k/\"\n",
+ "super_reactions = [4, 5]\n",
+ "test = pd.read_csv(\"./Datasets/ml-100k/test.csv\", sep=\"\\t\", header=None)\n",
+ "\n",
+ "ev.evaluate_all(test, dir_path, super_reactions)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {