Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
bdf06c9c28 | |||
587f3d3661 | |||
60194de853 | |||
5bd0649ffa | |||
fa6ba669c8 | |||
4499231c79 |
698
.ipynb_checkpoints/P0. Data preparation-checkpoint.ipynb
Normal file
698
.ipynb_checkpoints/P0. Data preparation-checkpoint.ipynb
Normal file
File diff suppressed because one or more lines are too long
1527
.ipynb_checkpoints/P1. Baseline-checkpoint.ipynb
Normal file
1527
.ipynb_checkpoints/P1. Baseline-checkpoint.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
1678
.ipynb_checkpoints/P2. Evaluation-checkpoint.ipynb
Normal file
1678
.ipynb_checkpoints/P2. Evaluation-checkpoint.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
1057
.ipynb_checkpoints/P3. k-nearest neighbours-checkpoint.ipynb
Normal file
1057
.ipynb_checkpoints/P3. k-nearest neighbours-checkpoint.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -195,7 +195,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<3x4 sparse matrix of type '<class 'numpy.int64'>'\n",
|
||||
"<3x4 sparse matrix of type '<class 'numpy.intc'>'\n",
|
||||
"\twith 8 stored elements in Compressed Sparse Row format>"
|
||||
]
|
||||
},
|
||||
@ -229,7 +229,7 @@
|
||||
"text/plain": [
|
||||
"matrix([[4, 1, 3, 0],\n",
|
||||
" [0, 2, 0, 1],\n",
|
||||
" [2, 0, 5, 4]])"
|
||||
" [2, 0, 5, 4]], dtype=int32)"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -306,7 +306,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1.13 µs ± 79.9 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)\n",
|
||||
"471 ns ± 15.3 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)\n",
|
||||
"Inefficient way to access items rated by user:\n"
|
||||
]
|
||||
},
|
||||
@ -314,7 +314,7 @@
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"array([ 0, 6, 10, 27, 49, 78, 95, 97, 116, 143, 153, 156, 167,\n",
|
||||
" 171, 172, 173, 194, 208, 225, 473, 495, 549, 615], dtype=int32)"
|
||||
" 171, 172, 173, 194, 208, 225, 473, 495, 549, 615])"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -324,7 +324,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"149 µs ± 11.5 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n"
|
||||
"48.3 µs ± 1.51 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -364,7 +364,7 @@
|
||||
"text/plain": [
|
||||
"matrix([[4, 1, 3, 0],\n",
|
||||
" [0, 2, 0, 1],\n",
|
||||
" [2, 0, 5, 4]])"
|
||||
" [2, 0, 5, 4]], dtype=int32)"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -877,7 +877,7 @@
|
||||
"text/plain": [
|
||||
"matrix([[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": {},
|
||||
@ -1070,6 +1070,269 @@
|
||||
"- For each row of matrix M' representing the user u, we compute the mean of ratings and denote by b_u."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class selfBaselineIU():\n",
|
||||
" \n",
|
||||
" def fit(self, train_ui):\n",
|
||||
" self.train_ui=train_ui.copy()\n",
|
||||
" self.train_iu=train_ui.transpose().tocsr()\n",
|
||||
" \n",
|
||||
" result=self.train_ui.copy()\n",
|
||||
" \n",
|
||||
" #we can't do result=train_ui-to_subtract_rows since then 0 entries will \"disappear\" in csr format\n",
|
||||
" self.col_means=np.divide(np.asarray(result.sum(axis=0).ravel())[0], np.diff(self.train_iu.indptr),\\\n",
|
||||
" out=np.zeros(self.train_iu.shape[0]), where=np.diff(self.train_iu.indptr)!=0) # handling items without ratings\n",
|
||||
" \n",
|
||||
" # again - it is possible that some mean will be zero, so let's use the same workaround\n",
|
||||
" col_means=self.col_means.copy()\n",
|
||||
" \n",
|
||||
" max_col_mean=np.max(col_means)\n",
|
||||
" col_means[col_means==0]=max_col_mean+1\n",
|
||||
" to_subtract_cols=result.power(0)*sparse.diags(col_means)\n",
|
||||
" to_subtract_cols.sort_indices() # needed to have valid .data\n",
|
||||
" \n",
|
||||
" subtract=to_subtract_cols.data\n",
|
||||
" subtract[subtract==max_col_mean+1]=0\n",
|
||||
" \n",
|
||||
" result.data=result.data-subtract\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" self.row_means=np.asarray(result.sum(axis=1).ravel())[0]/np.diff(result.indptr)\n",
|
||||
" \n",
|
||||
" # in csr format after addition or multiplication 0 entries \"disappear\" - so some workaraunds are needed \n",
|
||||
" # (other option is to define addition/multiplication in a desired way)\n",
|
||||
" row_means=self.row_means.copy()\n",
|
||||
" \n",
|
||||
" max_row_mean=np.max(row_means)\n",
|
||||
" row_means[row_means==0]=max_row_mean+1\n",
|
||||
" to_subtract_rows=sparse.diags(row_means)*(result.power(0))\n",
|
||||
" to_subtract_rows.sort_indices() # needed to have valid .data\n",
|
||||
" \n",
|
||||
" subtract=to_subtract_rows.data\n",
|
||||
" subtract[subtract==max_row_mean+1]=0\n",
|
||||
" \n",
|
||||
" result.data=result.data-subtract\n",
|
||||
"\n",
|
||||
" return result\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" def recommend(self, user_code_id, item_code_id, topK=10):\n",
|
||||
" estimations=np.tile(self.row_means[:,None], [1, self.train_ui.shape[1]]) +np.tile(self.col_means, [self.train_ui.shape[0], 1])\n",
|
||||
" \n",
|
||||
" top_k = defaultdict(list)\n",
|
||||
" for nb_user, user in enumerate(estimations):\n",
|
||||
" \n",
|
||||
" user_rated=self.train_ui.indices[self.train_ui.indptr[nb_user]:self.train_ui.indptr[nb_user+1]]\n",
|
||||
" for item, score in enumerate(user):\n",
|
||||
" if item not in user_rated:\n",
|
||||
" top_k[user_code_id[nb_user]].append((item_code_id[item], score))\n",
|
||||
" result=[]\n",
|
||||
" # Let's choose k best items in the format: (user, item1, score1, item2, score2, ...)\n",
|
||||
" for uid, item_scores in top_k.items():\n",
|
||||
" item_scores.sort(key=lambda x: x[1], reverse=True)\n",
|
||||
" result.append([uid]+list(chain(*item_scores[:topK])))\n",
|
||||
" return result\n",
|
||||
" \n",
|
||||
" def estimate(self, user_code_id, item_code_id, test_ui):\n",
|
||||
" result=[]\n",
|
||||
" for user, item in zip(*test_ui.nonzero()):\n",
|
||||
" result.append([user_code_id[user], item_code_id[item], self.row_means[user]+self.col_means[item]])\n",
|
||||
" return result"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Training data:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"matrix([[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]], dtype=int64)"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"After subtracting columns and rows:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"matrix([[-0.375 , 1.125 , 0. , 0. , -0.375 ,\n",
|
||||
" 0. , 0. , -0.375 ],\n",
|
||||
" [ 0. , -0.66666667, 0.83333333, -0.16666667, 0. ,\n",
|
||||
" 0. , 0. , 0. ],\n",
|
||||
" [ 0. , 0. , 0. , 0.66666667, 0. ,\n",
|
||||
" -0.33333333, -0.33333333, 0. ]])"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Recommend best unseen item:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[[0, 30, 4.375], [10, 40, 4.166666666666667], [20, 40, 5.333333333333333]]"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Print estimations on unseen items:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"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>user</th>\n",
|
||||
" <th>item</th>\n",
|
||||
" <th>est_score</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>60</td>\n",
|
||||
" <td>4.375000</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>40</td>\n",
|
||||
" <td>4.166667</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>20</td>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>3.333333</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>20</td>\n",
|
||||
" <td>20</td>\n",
|
||||
" <td>2.333333</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>20</td>\n",
|
||||
" <td>70</td>\n",
|
||||
" <td>4.333333</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" user item est_score\n",
|
||||
"0 0 60 4.375000\n",
|
||||
"1 10 40 4.166667\n",
|
||||
"2 20 0 3.333333\n",
|
||||
"3 20 20 2.333333\n",
|
||||
"4 20 70 4.333333"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"toy_train_read=pd.read_csv('./Datasets/toy-example/train.csv', sep='\\t', header=None, names=['user', 'item', 'rating', 'timestamp'])\n",
|
||||
"toy_test_read=pd.read_csv('./Datasets/toy-example/test.csv', sep='\\t', header=None, names=['user', 'item', 'rating', 'timestamp'])\n",
|
||||
"\n",
|
||||
"toy_train_iu, toy_test_iu, toy_user_code_id, toy_user_id_code, \\\n",
|
||||
"toy_item_code_id, toy_item_id_code = helpers.data_to_csr(toy_train_read, toy_test_read)\n",
|
||||
"\n",
|
||||
"print('Training data:')\n",
|
||||
"display(toy_train_iu.todense())\n",
|
||||
"\n",
|
||||
"model=selfBaselineIU()\n",
|
||||
"print('After subtracting columns and rows:')\n",
|
||||
"display(model.fit(toy_train_iu).todense())\n",
|
||||
"\n",
|
||||
"print('Recommend best unseen item:')\n",
|
||||
"display(model.recommend(toy_user_code_id, toy_item_code_id, topK=1))\n",
|
||||
"\n",
|
||||
"print('Print estimations on unseen items:')\n",
|
||||
"estimations=pd.DataFrame(model.estimate(toy_user_code_id, toy_item_code_id, toy_test_iu))\n",
|
||||
"estimations.columns=['user', 'item', 'est_score']\n",
|
||||
"display(estimations)\n",
|
||||
"\n",
|
||||
"top_n=pd.DataFrame(model.recommend(toy_user_code_id, toy_item_code_id, topK=3))\n",
|
||||
"\n",
|
||||
"top_n.to_csv('Recommendations generated/toy-example/Self_BaselineIU_reco.csv', index=False, header=False)\n",
|
||||
"\n",
|
||||
"estimations=pd.DataFrame(model.estimate(toy_user_code_id, toy_item_code_id, toy_test_iu))\n",
|
||||
"estimations.to_csv('Recommendations generated/toy-example/Self_BaselineIU_estimations.csv', index=False, header=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"model=selfBaselineIU()\n",
|
||||
"model.fit(train_ui)\n",
|
||||
"\n",
|
||||
"top_n=pd.DataFrame(model.recommend(user_code_id, item_code_id, topK=10))\n",
|
||||
"\n",
|
||||
"top_n.to_csv('Recommendations generated/Projects/Project1_Self_BaselineIU_reco.csv', index=False, header=False)\n",
|
||||
"\n",
|
||||
"estimations=pd.DataFrame(model.estimate(user_code_id, item_code_id, test_ui))\n",
|
||||
"estimations.to_csv('Recommendations generated/Projects/Project1_Self_BaselineIU_estimations.csv', index=False, header=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@ -1079,7 +1342,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1136,7 +1399,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1153,7 +1416,7 @@
|
||||
"0.7524871012820799"
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1190,14 +1453,14 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"RMSE: 1.5239\n",
|
||||
"MAE: 1.2268\n"
|
||||
"RMSE: 1.5165\n",
|
||||
"MAE: 1.2172\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1.2267993503843746"
|
||||
"1.2172144988785374"
|
||||
]
|
||||
},
|
||||
"execution_count": 24,
|
||||
@ -1251,7 +1514,12 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5"
|
||||
"version": "3.8.8"
|
||||
},
|
||||
"metadata": {
|
||||
"interpreter": {
|
||||
"hash": "2a3a95f8b675c5b7dd6a35e1675edaf697539b1f0a71c4603e9520a8bbd07d82"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -397,7 +397,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -453,7 +453,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -500,7 +500,7 @@
|
||||
"0 1.0 0.033911 2.836513 0.991139"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -521,14 +521,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"943it [00:00, 11012.47it/s]\n"
|
||||
"943it [00:00, 12952.59it/s]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -565,6 +565,8 @@
|
||||
" <th>MRR</th>\n",
|
||||
" <th>LAUC</th>\n",
|
||||
" <th>HR</th>\n",
|
||||
" <th>HitRate2</th>\n",
|
||||
" <th>HitRate3</th>\n",
|
||||
" <th>Reco in test</th>\n",
|
||||
" <th>Test coverage</th>\n",
|
||||
" <th>Shannon</th>\n",
|
||||
@ -587,6 +589,8 @@
|
||||
" <td>0.198193</td>\n",
|
||||
" <td>0.515501</td>\n",
|
||||
" <td>0.437964</td>\n",
|
||||
" <td>0.239661</td>\n",
|
||||
" <td>0.126193</td>\n",
|
||||
" <td>1.0</td>\n",
|
||||
" <td>0.033911</td>\n",
|
||||
" <td>2.836513</td>\n",
|
||||
@ -603,11 +607,14 @@
|
||||
" precision_super recall_super NDCG mAP MRR LAUC \\\n",
|
||||
"0 0.079614 0.056463 0.095957 0.043178 0.198193 0.515501 \n",
|
||||
"\n",
|
||||
" HR Reco in test Test coverage Shannon Gini \n",
|
||||
"0 0.437964 1.0 0.033911 2.836513 0.991139 "
|
||||
" HR HitRate2 HitRate3 Reco in test Test coverage Shannon \\\n",
|
||||
"0 0.437964 0.239661 0.126193 1.0 0.033911 2.836513 \n",
|
||||
"\n",
|
||||
" Gini \n",
|
||||
"0 0.991139 "
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -633,18 +640,19 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"943it [00:00, 10346.82it/s]\n",
|
||||
"943it [00:00, 11772.32it/s]\n",
|
||||
"943it [00:00, 10636.62it/s]\n",
|
||||
"943it [00:00, 10767.92it/s]\n",
|
||||
"943it [00:00, 12019.93it/s]\n"
|
||||
"943it [00:00, 13130.52it/s]\n",
|
||||
"943it [00:00, 12777.31it/s]\n",
|
||||
"943it [00:00, 13513.65it/s]\n",
|
||||
"943it [00:00, 13323.06it/s]\n",
|
||||
"943it [00:00, 13507.69it/s]\n",
|
||||
"943it [00:00, 13697.48it/s]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -659,7 +667,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -722,14 +730,14 @@
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_Random</td>\n",
|
||||
" <td>1.521845</td>\n",
|
||||
" <td>1.225949</td>\n",
|
||||
" <td>0.047190</td>\n",
|
||||
" <td>0.020753</td>\n",
|
||||
" <td>0.024810</td>\n",
|
||||
" <td>0.032269</td>\n",
|
||||
" <td>0.029506</td>\n",
|
||||
" <td>0.023707</td>\n",
|
||||
" <td>1.516512</td>\n",
|
||||
" <td>1.217214</td>\n",
|
||||
" <td>0.045599</td>\n",
|
||||
" <td>0.021001</td>\n",
|
||||
" <td>0.024136</td>\n",
|
||||
" <td>0.031226</td>\n",
|
||||
" <td>0.028541</td>\n",
|
||||
" <td>0.022057</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
@ -755,6 +763,18 @@
|
||||
" <td>0.000644</td>\n",
|
||||
" <td>0.000189</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_IKNN</td>\n",
|
||||
" <td>1.018363</td>\n",
|
||||
" <td>0.808793</td>\n",
|
||||
" <td>0.000318</td>\n",
|
||||
" <td>0.000108</td>\n",
|
||||
" <td>0.000140</td>\n",
|
||||
" <td>0.000189</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
@ -763,19 +783,21 @@
|
||||
" 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 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 \n",
|
||||
"0 0.141584 0.130472 0.137473 \n",
|
||||
"0 0.061286 0.079614 0.056463 \n",
|
||||
"0 0.032269 0.029506 0.023707 \n",
|
||||
"0 0.031226 0.028541 0.022057 \n",
|
||||
"0 0.000481 0.000644 0.000223 \n",
|
||||
"0 0.000463 0.000644 0.000189 "
|
||||
"0 0.000463 0.000644 0.000189 \n",
|
||||
"0 0.000189 0.000000 0.000000 "
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -786,7 +808,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -816,6 +838,8 @@
|
||||
" <th>MRR</th>\n",
|
||||
" <th>LAUC</th>\n",
|
||||
" <th>HR</th>\n",
|
||||
" <th>HitRate2</th>\n",
|
||||
" <th>HitRate3</th>\n",
|
||||
" <th>Reco in test</th>\n",
|
||||
" <th>Test coverage</th>\n",
|
||||
" <th>Shannon</th>\n",
|
||||
@ -831,6 +855,8 @@
|
||||
" <td>0.400939</td>\n",
|
||||
" <td>0.555546</td>\n",
|
||||
" <td>0.765642</td>\n",
|
||||
" <td>0.492047</td>\n",
|
||||
" <td>0.290562</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.038961</td>\n",
|
||||
" <td>3.159079</td>\n",
|
||||
@ -844,6 +870,8 @@
|
||||
" <td>0.198193</td>\n",
|
||||
" <td>0.515501</td>\n",
|
||||
" <td>0.437964</td>\n",
|
||||
" <td>0.239661</td>\n",
|
||||
" <td>0.126193</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.033911</td>\n",
|
||||
" <td>2.836513</td>\n",
|
||||
@ -852,15 +880,17 @@
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_Random</td>\n",
|
||||
" <td>0.050075</td>\n",
|
||||
" <td>0.018728</td>\n",
|
||||
" <td>0.121957</td>\n",
|
||||
" <td>0.506893</td>\n",
|
||||
" <td>0.329799</td>\n",
|
||||
" <td>0.986532</td>\n",
|
||||
" <td>0.184704</td>\n",
|
||||
" <td>5.099706</td>\n",
|
||||
" <td>0.907217</td>\n",
|
||||
" <td>0.050154</td>\n",
|
||||
" <td>0.019000</td>\n",
|
||||
" <td>0.125089</td>\n",
|
||||
" <td>0.507013</td>\n",
|
||||
" <td>0.327678</td>\n",
|
||||
" <td>0.093319</td>\n",
|
||||
" <td>0.026511</td>\n",
|
||||
" <td>0.988017</td>\n",
|
||||
" <td>0.192641</td>\n",
|
||||
" <td>5.141246</td>\n",
|
||||
" <td>0.903763</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
@ -870,6 +900,8 @@
|
||||
" <td>0.003348</td>\n",
|
||||
" <td>0.496433</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.699046</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.945910</td>\n",
|
||||
@ -883,11 +915,28 @@
|
||||
" <td>0.001677</td>\n",
|
||||
" <td>0.496424</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.600530</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.803126</td>\n",
|
||||
" <td>0.996380</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_IKNN</td>\n",
|
||||
" <td>0.000214</td>\n",
|
||||
" <td>0.000037</td>\n",
|
||||
" <td>0.000368</td>\n",
|
||||
" <td>0.496391</td>\n",
|
||||
" <td>0.003181</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.392153</td>\n",
|
||||
" <td>0.115440</td>\n",
|
||||
" <td>4.174741</td>\n",
|
||||
" <td>0.965327</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
@ -896,19 +945,21 @@
|
||||
" Model NDCG mAP MRR LAUC HR \\\n",
|
||||
"0 Self_TopPop 0.214651 0.111707 0.400939 0.555546 0.765642 \n",
|
||||
"0 Ready_Baseline 0.095957 0.043178 0.198193 0.515501 0.437964 \n",
|
||||
"0 Ready_Random 0.050075 0.018728 0.121957 0.506893 0.329799 \n",
|
||||
"0 Ready_Random 0.050154 0.019000 0.125089 0.507013 0.327678 \n",
|
||||
"0 Self_TopRated 0.001043 0.000335 0.003348 0.496433 0.009544 \n",
|
||||
"0 Self_BaselineUI 0.000752 0.000168 0.001677 0.496424 0.009544 \n",
|
||||
"0 Self_IKNN 0.000214 0.000037 0.000368 0.496391 0.003181 \n",
|
||||
"\n",
|
||||
" Reco in test Test coverage Shannon Gini \n",
|
||||
"0 1.000000 0.038961 3.159079 0.987317 \n",
|
||||
"0 1.000000 0.033911 2.836513 0.991139 \n",
|
||||
"0 0.986532 0.184704 5.099706 0.907217 \n",
|
||||
"0 0.699046 0.005051 1.945910 0.995669 \n",
|
||||
"0 0.600530 0.005051 1.803126 0.996380 "
|
||||
" HitRate2 HitRate3 Reco in test Test coverage Shannon Gini \n",
|
||||
"0 0.492047 0.290562 1.000000 0.038961 3.159079 0.987317 \n",
|
||||
"0 0.239661 0.126193 1.000000 0.033911 2.836513 0.991139 \n",
|
||||
"0 0.093319 0.026511 0.988017 0.192641 5.141246 0.903763 \n",
|
||||
"0 0.000000 0.000000 0.699046 0.005051 1.945910 0.995669 \n",
|
||||
"0 0.000000 0.000000 0.600530 0.005051 1.803126 0.996380 \n",
|
||||
"0 0.000000 0.000000 0.392153 0.115440 4.174741 0.965327 "
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -926,14 +977,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"3it [00:00, 5771.98it/s]\n"
|
||||
"3it [00:00, ?it/s]\n",
|
||||
"3it [00:00, ?it/s]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -971,6 +1023,8 @@
|
||||
" <th>MRR</th>\n",
|
||||
" <th>LAUC</th>\n",
|
||||
" <th>HR</th>\n",
|
||||
" <th>HitRate2</th>\n",
|
||||
" <th>HitRate3</th>\n",
|
||||
" <th>Reco in test</th>\n",
|
||||
" <th>Test coverage</th>\n",
|
||||
" <th>Shannon</th>\n",
|
||||
@ -982,7 +1036,7 @@
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_BaselineUI</td>\n",
|
||||
" <td>1.612452</td>\n",
|
||||
" <td>1.4</td>\n",
|
||||
" <td>1.400</td>\n",
|
||||
" <td>0.444444</td>\n",
|
||||
" <td>0.888889</td>\n",
|
||||
" <td>0.555556</td>\n",
|
||||
@ -994,24 +1048,52 @@
|
||||
" <td>0.611111</td>\n",
|
||||
" <td>0.638889</td>\n",
|
||||
" <td>1.0</td>\n",
|
||||
" <td>0.333333</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>0.888889</td>\n",
|
||||
" <td>0.8</td>\n",
|
||||
" <td>1.386294</td>\n",
|
||||
" <td>0.25</td>\n",
|
||||
" <td>0.250000</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_BaselineIU</td>\n",
|
||||
" <td>1.648337</td>\n",
|
||||
" <td>1.575</td>\n",
|
||||
" <td>0.444444</td>\n",
|
||||
" <td>0.888889</td>\n",
|
||||
" <td>0.555556</td>\n",
|
||||
" <td>0.478632</td>\n",
|
||||
" <td>0.333333</td>\n",
|
||||
" <td>0.75</td>\n",
|
||||
" <td>0.720550</td>\n",
|
||||
" <td>0.629630</td>\n",
|
||||
" <td>0.666667</td>\n",
|
||||
" <td>0.722222</td>\n",
|
||||
" <td>1.0</td>\n",
|
||||
" <td>0.333333</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>0.777778</td>\n",
|
||||
" <td>0.8</td>\n",
|
||||
" <td>1.351784</td>\n",
|
||||
" <td>0.357143</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" Model RMSE MAE precision recall F_1 F_05 \\\n",
|
||||
"0 Self_BaselineUI 1.612452 1.4 0.444444 0.888889 0.555556 0.478632 \n",
|
||||
" Model RMSE MAE precision recall F_1 F_05 \\\n",
|
||||
"0 Self_BaselineUI 1.612452 1.400 0.444444 0.888889 0.555556 0.478632 \n",
|
||||
"0 Self_BaselineIU 1.648337 1.575 0.444444 0.888889 0.555556 0.478632 \n",
|
||||
"\n",
|
||||
" precision_super recall_super NDCG mAP MRR LAUC HR \\\n",
|
||||
"0 0.333333 0.75 0.676907 0.574074 0.611111 0.638889 1.0 \n",
|
||||
"0 0.333333 0.75 0.720550 0.629630 0.666667 0.722222 1.0 \n",
|
||||
"\n",
|
||||
" Reco in test Test coverage Shannon Gini \n",
|
||||
"0 0.888889 0.8 1.386294 0.25 "
|
||||
" HitRate2 HitRate3 Reco in test Test coverage Shannon Gini \n",
|
||||
"0 0.333333 0.0 0.888889 0.8 1.386294 0.250000 \n",
|
||||
"0 0.333333 0.0 0.777778 0.8 1.351784 0.357143 "
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -1029,7 +1111,7 @@
|
||||
"text/plain": [
|
||||
"matrix([[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": {},
|
||||
@ -1047,7 +1129,7 @@
|
||||
"text/plain": [
|
||||
"matrix([[0, 0, 0, 0, 0, 0, 3, 0],\n",
|
||||
" [0, 0, 0, 0, 5, 0, 0, 0],\n",
|
||||
" [5, 0, 4, 0, 0, 0, 0, 2]])"
|
||||
" [5, 0, 4, 0, 0, 0, 0, 2]], dtype=int64)"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -1276,7 +1358,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1315,148 +1397,148 @@
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>57482</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>36652</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Emma (1996)</td>\n",
|
||||
" <td>Drama, Romance</td>\n",
|
||||
" <td>Lone Star (1996)</td>\n",
|
||||
" <td>Drama, Mystery</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>54506</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Sense and Sensibility (1995)</td>\n",
|
||||
" <td>Drama, Romance</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>40581</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Titanic (1997)</td>\n",
|
||||
" <td>Action, Drama, Romance</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2949</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>3143</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Star Wars (1977)</td>\n",
|
||||
" <td>Action, Adventure, Romance, Sci-Fi, War</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>69653</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Wings of the Dove, The (1997)</td>\n",
|
||||
" <td>Drama, Romance, Thriller</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7906</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>As Good As It Gets (1997)</td>\n",
|
||||
" <td>Comedy, Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>69400</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Shall We Dance? (1996)</td>\n",
|
||||
" <td>Comedy</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>14469</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Fargo (1996)</td>\n",
|
||||
" <td>Crime, Drama, Thriller</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>46151</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>L.A. Confidential (1997)</td>\n",
|
||||
" <td>Crime, Film-Noir, Mystery, Thriller</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>67293</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Good Will Hunting (1997)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>20923</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Secrets & Lies (1996)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>52921</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>52919</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Kolya (1996)</td>\n",
|
||||
" <td>Comedy</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>50103</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>275</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Mrs. Brown (Her Majesty, Mrs. Brown) (1997)</td>\n",
|
||||
" <td>Drama, Romance</td>\n",
|
||||
" <td>Toy Story (1995)</td>\n",
|
||||
" <td>Animation, Children's, Comedy</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>51972</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>41134</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Trainspotting (1996)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>28094</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Face/Off (1997)</td>\n",
|
||||
" <td>Action, Sci-Fi, Thriller</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>26548</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Everyone Says I Love You (1996)</td>\n",
|
||||
" <td>Comedy, Musical, Romance</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>26186</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Air Force One (1997)</td>\n",
|
||||
" <td>Action, Thriller</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>25791</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Dead Man Walking (1995)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>51948</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Mighty Aphrodite (1995)</td>\n",
|
||||
" <td>Comedy</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>515</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" <th>52778</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Heat (1995)</td>\n",
|
||||
" <td>Action, Crime, Thriller</td>\n",
|
||||
" <td>Fly Away Home (1996)</td>\n",
|
||||
" <td>Adventure, Children's</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>20966</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Secrets & Lies (1996)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>19301</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Scream (1996)</td>\n",
|
||||
" <td>Horror, Thriller</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>54450</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Sense and Sensibility (1995)</td>\n",
|
||||
" <td>Drama, Romance</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>17177</th>\n",
|
||||
" <td>735</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Leaving Las Vegas (1995)</td>\n",
|
||||
" <td>Drama, Romance</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" user rating title \\\n",
|
||||
"57482 2 5 Emma (1996) \n",
|
||||
"54506 2 5 Sense and Sensibility (1995) \n",
|
||||
"40581 2 5 Titanic (1997) \n",
|
||||
"2949 2 5 Star Wars (1977) \n",
|
||||
"69653 2 5 Wings of the Dove, The (1997) \n",
|
||||
"7906 2 5 As Good As It Gets (1997) \n",
|
||||
"69400 2 5 Shall We Dance? (1996) \n",
|
||||
"14469 2 5 Fargo (1996) \n",
|
||||
"46151 2 5 L.A. Confidential (1997) \n",
|
||||
"67293 2 5 Good Will Hunting (1997) \n",
|
||||
"20923 2 5 Secrets & Lies (1996) \n",
|
||||
"52921 2 5 Kolya (1996) \n",
|
||||
"50103 2 4 Mrs. Brown (Her Majesty, Mrs. Brown) (1997) \n",
|
||||
"51972 2 4 Mighty Aphrodite (1995) \n",
|
||||
"515 2 4 Heat (1995) \n",
|
||||
" user rating title \\\n",
|
||||
"36652 735 5 Lone Star (1996) \n",
|
||||
"3143 735 5 Star Wars (1977) \n",
|
||||
"52919 735 5 Kolya (1996) \n",
|
||||
"275 735 4 Toy Story (1995) \n",
|
||||
"41134 735 4 Trainspotting (1996) \n",
|
||||
"28094 735 4 Face/Off (1997) \n",
|
||||
"26548 735 4 Everyone Says I Love You (1996) \n",
|
||||
"26186 735 4 Air Force One (1997) \n",
|
||||
"25791 735 4 Dead Man Walking (1995) \n",
|
||||
"51948 735 4 Mighty Aphrodite (1995) \n",
|
||||
"52778 735 4 Fly Away Home (1996) \n",
|
||||
"20966 735 4 Secrets & Lies (1996) \n",
|
||||
"19301 735 4 Scream (1996) \n",
|
||||
"54450 735 4 Sense and Sensibility (1995) \n",
|
||||
"17177 735 4 Leaving Las Vegas (1995) \n",
|
||||
"\n",
|
||||
" genres \n",
|
||||
"57482 Drama, Romance \n",
|
||||
"54506 Drama, Romance \n",
|
||||
"40581 Action, Drama, Romance \n",
|
||||
"2949 Action, Adventure, Romance, Sci-Fi, War \n",
|
||||
"69653 Drama, Romance, Thriller \n",
|
||||
"7906 Comedy, Drama \n",
|
||||
"69400 Comedy \n",
|
||||
"14469 Crime, Drama, Thriller \n",
|
||||
"46151 Crime, Film-Noir, Mystery, Thriller \n",
|
||||
"67293 Drama \n",
|
||||
"20923 Drama \n",
|
||||
"52921 Comedy \n",
|
||||
"50103 Drama, Romance \n",
|
||||
"51972 Comedy \n",
|
||||
"515 Action, Crime, Thriller "
|
||||
"36652 Drama, Mystery \n",
|
||||
"3143 Action, Adventure, Romance, Sci-Fi, War \n",
|
||||
"52919 Comedy \n",
|
||||
"275 Animation, Children's, Comedy \n",
|
||||
"41134 Drama \n",
|
||||
"28094 Action, Sci-Fi, Thriller \n",
|
||||
"26548 Comedy, Musical, Romance \n",
|
||||
"26186 Action, Thriller \n",
|
||||
"25791 Drama \n",
|
||||
"51948 Comedy \n",
|
||||
"52778 Adventure, Children's \n",
|
||||
"20966 Drama \n",
|
||||
"19301 Horror, Thriller \n",
|
||||
"54450 Drama, Romance \n",
|
||||
"17177 Drama, Romance "
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -1498,71 +1580,71 @@
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>733</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>Great Day in Harlem, A (1994)</td>\n",
|
||||
" <td>Documentary</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>943</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>1675</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>Tough and Deadly (1995)</td>\n",
|
||||
" <td>Action, Drama, Thriller</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1885</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>2617</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>3</td>\n",
|
||||
" <td>Aiqing wansui (1994)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2827</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>3559</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>Delta of Venus (1994)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3769</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>4501</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>Someone Else's America (1995)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4711</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>5443</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>6</td>\n",
|
||||
" <td>Saint of Fort Washington, The (1993)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>5653</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>6385</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>7</td>\n",
|
||||
" <td>Celestial Clockwork (1994)</td>\n",
|
||||
" <td>Comedy</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6595</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>7326</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>8</td>\n",
|
||||
" <td>Some Mother's Son (1996)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>8489</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>9222</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>9</td>\n",
|
||||
" <td>Maya Lin: A Strong Clear Vision (1994)</td>\n",
|
||||
" <td>Documentary</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>7536</th>\n",
|
||||
" <td>2.0</td>\n",
|
||||
" <th>8268</th>\n",
|
||||
" <td>735.0</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>Prefontaine (1997)</td>\n",
|
||||
" <td>Drama</td>\n",
|
||||
@ -1572,32 +1654,32 @@
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" user rec_nb title \\\n",
|
||||
"1 2.0 1 Great Day in Harlem, A (1994) \n",
|
||||
"943 2.0 2 Tough and Deadly (1995) \n",
|
||||
"1885 2.0 3 Aiqing wansui (1994) \n",
|
||||
"2827 2.0 4 Delta of Venus (1994) \n",
|
||||
"3769 2.0 5 Someone Else's America (1995) \n",
|
||||
"4711 2.0 6 Saint of Fort Washington, The (1993) \n",
|
||||
"5653 2.0 7 Celestial Clockwork (1994) \n",
|
||||
"6595 2.0 8 Some Mother's Son (1996) \n",
|
||||
"8489 2.0 9 Maya Lin: A Strong Clear Vision (1994) \n",
|
||||
"7536 2.0 10 Prefontaine (1997) \n",
|
||||
" user rec_nb title \\\n",
|
||||
"733 735.0 1 Great Day in Harlem, A (1994) \n",
|
||||
"1675 735.0 2 Tough and Deadly (1995) \n",
|
||||
"2617 735.0 3 Aiqing wansui (1994) \n",
|
||||
"3559 735.0 4 Delta of Venus (1994) \n",
|
||||
"4501 735.0 5 Someone Else's America (1995) \n",
|
||||
"5443 735.0 6 Saint of Fort Washington, The (1993) \n",
|
||||
"6385 735.0 7 Celestial Clockwork (1994) \n",
|
||||
"7326 735.0 8 Some Mother's Son (1996) \n",
|
||||
"9222 735.0 9 Maya Lin: A Strong Clear Vision (1994) \n",
|
||||
"8268 735.0 10 Prefontaine (1997) \n",
|
||||
"\n",
|
||||
" genres \n",
|
||||
"1 Documentary \n",
|
||||
"943 Action, Drama, Thriller \n",
|
||||
"1885 Drama \n",
|
||||
"2827 Drama \n",
|
||||
"3769 Drama \n",
|
||||
"4711 Drama \n",
|
||||
"5653 Comedy \n",
|
||||
"6595 Drama \n",
|
||||
"8489 Documentary \n",
|
||||
"7536 Drama "
|
||||
"733 Documentary \n",
|
||||
"1675 Action, Drama, Thriller \n",
|
||||
"2617 Drama \n",
|
||||
"3559 Drama \n",
|
||||
"4501 Drama \n",
|
||||
"5443 Drama \n",
|
||||
"6385 Comedy \n",
|
||||
"7326 Drama \n",
|
||||
"9222 Documentary \n",
|
||||
"8268 Drama "
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1684,7 +1766,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5"
|
||||
"version": "3.8.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -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 @@
|
||||
" <th>MRR</th>\n",
|
||||
" <th>LAUC</th>\n",
|
||||
" <th>HR</th>\n",
|
||||
" <th>HitRate2</th>\n",
|
||||
" <th>HitRate3</th>\n",
|
||||
" <th>Reco in test</th>\n",
|
||||
" <th>Test coverage</th>\n",
|
||||
" <th>Shannon</th>\n",
|
||||
@ -315,6 +317,8 @@
|
||||
" <td>0.000368</td>\n",
|
||||
" <td>0.496391</td>\n",
|
||||
" <td>0.003181</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>0.0</td>\n",
|
||||
" <td>0.392153</td>\n",
|
||||
" <td>0.11544</td>\n",
|
||||
" <td>4.174741</td>\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 @@
|
||||
" <th>MRR</th>\n",
|
||||
" <th>LAUC</th>\n",
|
||||
" <th>HR</th>\n",
|
||||
" <th>HitRate2</th>\n",
|
||||
" <th>HitRate3</th>\n",
|
||||
" <th>Reco in test</th>\n",
|
||||
" <th>Test coverage</th>\n",
|
||||
" <th>Shannon</th>\n",
|
||||
@ -431,6 +443,8 @@
|
||||
" <td>0.400939</td>\n",
|
||||
" <td>0.555546</td>\n",
|
||||
" <td>0.765642</td>\n",
|
||||
" <td>0.492047</td>\n",
|
||||
" <td>0.290562</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.038961</td>\n",
|
||||
" <td>3.159079</td>\n",
|
||||
@ -452,6 +466,8 @@
|
||||
" <td>0.198193</td>\n",
|
||||
" <td>0.515501</td>\n",
|
||||
" <td>0.437964</td>\n",
|
||||
" <td>0.239661</td>\n",
|
||||
" <td>0.126193</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.033911</td>\n",
|
||||
" <td>2.836513</td>\n",
|
||||
@ -460,23 +476,94 @@
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_Random</td>\n",
|
||||
" <td>1.521845</td>\n",
|
||||
" <td>1.225949</td>\n",
|
||||
" <td>0.047190</td>\n",
|
||||
" <td>0.020753</td>\n",
|
||||
" <td>0.024810</td>\n",
|
||||
" <td>0.032269</td>\n",
|
||||
" <td>0.029506</td>\n",
|
||||
" <td>0.023707</td>\n",
|
||||
" <td>0.050075</td>\n",
|
||||
" <td>0.018728</td>\n",
|
||||
" <td>0.121957</td>\n",
|
||||
" <td>0.506893</td>\n",
|
||||
" <td>0.329799</td>\n",
|
||||
" <td>0.986532</td>\n",
|
||||
" <td>0.184704</td>\n",
|
||||
" <td>5.099706</td>\n",
|
||||
" <td>0.907217</td>\n",
|
||||
" <td>1.516512</td>\n",
|
||||
" <td>1.217214</td>\n",
|
||||
" <td>0.045599</td>\n",
|
||||
" <td>0.021001</td>\n",
|
||||
" <td>0.024136</td>\n",
|
||||
" <td>0.031226</td>\n",
|
||||
" <td>0.028541</td>\n",
|
||||
" <td>0.022057</td>\n",
|
||||
" <td>0.050154</td>\n",
|
||||
" <td>0.019000</td>\n",
|
||||
" <td>0.125089</td>\n",
|
||||
" <td>0.507013</td>\n",
|
||||
" <td>0.327678</td>\n",
|
||||
" <td>0.093319</td>\n",
|
||||
" <td>0.026511</td>\n",
|
||||
" <td>0.988017</td>\n",
|
||||
" <td>0.192641</td>\n",
|
||||
" <td>5.141246</td>\n",
|
||||
" <td>0.903763</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_I-KNN</td>\n",
|
||||
" <td>1.030386</td>\n",
|
||||
" <td>0.813067</td>\n",
|
||||
" <td>0.026087</td>\n",
|
||||
" <td>0.006908</td>\n",
|
||||
" <td>0.010593</td>\n",
|
||||
" <td>0.016046</td>\n",
|
||||
" <td>0.021137</td>\n",
|
||||
" <td>0.009522</td>\n",
|
||||
" <td>0.024214</td>\n",
|
||||
" <td>0.008958</td>\n",
|
||||
" <td>0.048068</td>\n",
|
||||
" <td>0.499885</td>\n",
|
||||
" <td>0.154825</td>\n",
|
||||
" <td>0.072110</td>\n",
|
||||
" <td>0.024390</td>\n",
|
||||
" <td>0.402333</td>\n",
|
||||
" <td>0.434343</td>\n",
|
||||
" <td>5.133650</td>\n",
|
||||
" <td>0.877999</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_I-KNNBaseline</td>\n",
|
||||
" <td>0.935327</td>\n",
|
||||
" <td>0.737424</td>\n",
|
||||
" <td>0.002545</td>\n",
|
||||
" <td>0.000755</td>\n",
|
||||
" <td>0.001105</td>\n",
|
||||
" <td>0.001602</td>\n",
|
||||
" <td>0.002253</td>\n",
|
||||
" <td>0.000930</td>\n",
|
||||
" <td>0.003444</td>\n",
|
||||
" <td>0.001362</td>\n",
|
||||
" <td>0.011760</td>\n",
|
||||
" <td>0.496724</td>\n",
|
||||
" <td>0.021209</td>\n",
|
||||
" <td>0.004242</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.482821</td>\n",
|
||||
" <td>0.059885</td>\n",
|
||||
" <td>2.232578</td>\n",
|
||||
" <td>0.994487</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_U-KNN</td>\n",
|
||||
" <td>1.023495</td>\n",
|
||||
" <td>0.807913</td>\n",
|
||||
" <td>0.000742</td>\n",
|
||||
" <td>0.000205</td>\n",
|
||||
" <td>0.000305</td>\n",
|
||||
" <td>0.000449</td>\n",
|
||||
" <td>0.000536</td>\n",
|
||||
" <td>0.000198</td>\n",
|
||||
" <td>0.000845</td>\n",
|
||||
" <td>0.000274</td>\n",
|
||||
" <td>0.002744</td>\n",
|
||||
" <td>0.496441</td>\n",
|
||||
" <td>0.007423</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.602121</td>\n",
|
||||
" <td>0.010823</td>\n",
|
||||
" <td>2.089186</td>\n",
|
||||
" <td>0.995706</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
@ -494,6 +581,8 @@
|
||||
" <td>0.003348</td>\n",
|
||||
" <td>0.496433</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.699046</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.945910</td>\n",
|
||||
@ -515,6 +604,8 @@
|
||||
" <td>0.001677</td>\n",
|
||||
" <td>0.496424</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.600530</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.803126</td>\n",
|
||||
@ -536,6 +627,8 @@
|
||||
" <td>0.000368</td>\n",
|
||||
" <td>0.496391</td>\n",
|
||||
" <td>0.003181</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.392153</td>\n",
|
||||
" <td>0.115440</td>\n",
|
||||
" <td>4.174741</td>\n",
|
||||
@ -546,29 +639,49 @@
|
||||
"</div>"
|
||||
],
|
||||
"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 @@
|
||||
" <th>MRR</th>\n",
|
||||
" <th>LAUC</th>\n",
|
||||
" <th>HR</th>\n",
|
||||
" <th>HitRate2</th>\n",
|
||||
" <th>HitRate3</th>\n",
|
||||
" <th>Reco in test</th>\n",
|
||||
" <th>Test coverage</th>\n",
|
||||
" <th>Shannon</th>\n",
|
||||
@ -787,6 +902,8 @@
|
||||
" <td>0.400939</td>\n",
|
||||
" <td>0.555546</td>\n",
|
||||
" <td>0.765642</td>\n",
|
||||
" <td>0.492047</td>\n",
|
||||
" <td>0.290562</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.038961</td>\n",
|
||||
" <td>3.159079</td>\n",
|
||||
@ -808,6 +925,8 @@
|
||||
" <td>0.198193</td>\n",
|
||||
" <td>0.515501</td>\n",
|
||||
" <td>0.437964</td>\n",
|
||||
" <td>0.239661</td>\n",
|
||||
" <td>0.126193</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.033911</td>\n",
|
||||
" <td>2.836513</td>\n",
|
||||
@ -816,23 +935,25 @@
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_Random</td>\n",
|
||||
" <td>1.521845</td>\n",
|
||||
" <td>1.225949</td>\n",
|
||||
" <td>0.047190</td>\n",
|
||||
" <td>0.020753</td>\n",
|
||||
" <td>0.024810</td>\n",
|
||||
" <td>0.032269</td>\n",
|
||||
" <td>0.029506</td>\n",
|
||||
" <td>0.023707</td>\n",
|
||||
" <td>0.050075</td>\n",
|
||||
" <td>0.018728</td>\n",
|
||||
" <td>0.121957</td>\n",
|
||||
" <td>0.506893</td>\n",
|
||||
" <td>0.329799</td>\n",
|
||||
" <td>0.986532</td>\n",
|
||||
" <td>0.184704</td>\n",
|
||||
" <td>5.099706</td>\n",
|
||||
" <td>0.907217</td>\n",
|
||||
" <td>1.516512</td>\n",
|
||||
" <td>1.217214</td>\n",
|
||||
" <td>0.045599</td>\n",
|
||||
" <td>0.021001</td>\n",
|
||||
" <td>0.024136</td>\n",
|
||||
" <td>0.031226</td>\n",
|
||||
" <td>0.028541</td>\n",
|
||||
" <td>0.022057</td>\n",
|
||||
" <td>0.050154</td>\n",
|
||||
" <td>0.019000</td>\n",
|
||||
" <td>0.125089</td>\n",
|
||||
" <td>0.507013</td>\n",
|
||||
" <td>0.327678</td>\n",
|
||||
" <td>0.093319</td>\n",
|
||||
" <td>0.026511</td>\n",
|
||||
" <td>0.988017</td>\n",
|
||||
" <td>0.192641</td>\n",
|
||||
" <td>5.141246</td>\n",
|
||||
" <td>0.903763</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
@ -850,6 +971,8 @@
|
||||
" <td>0.048068</td>\n",
|
||||
" <td>0.499885</td>\n",
|
||||
" <td>0.154825</td>\n",
|
||||
" <td>0.072110</td>\n",
|
||||
" <td>0.024390</td>\n",
|
||||
" <td>0.402333</td>\n",
|
||||
" <td>0.434343</td>\n",
|
||||
" <td>5.133650</td>\n",
|
||||
@ -871,6 +994,8 @@
|
||||
" <td>0.011760</td>\n",
|
||||
" <td>0.496724</td>\n",
|
||||
" <td>0.021209</td>\n",
|
||||
" <td>0.004242</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.482821</td>\n",
|
||||
" <td>0.059885</td>\n",
|
||||
" <td>2.232578</td>\n",
|
||||
@ -892,6 +1017,8 @@
|
||||
" <td>0.002744</td>\n",
|
||||
" <td>0.496441</td>\n",
|
||||
" <td>0.007423</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.602121</td>\n",
|
||||
" <td>0.010823</td>\n",
|
||||
" <td>2.089186</td>\n",
|
||||
@ -913,6 +1040,8 @@
|
||||
" <td>0.003348</td>\n",
|
||||
" <td>0.496433</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.699046</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.945910</td>\n",
|
||||
@ -934,6 +1063,8 @@
|
||||
" <td>0.001677</td>\n",
|
||||
" <td>0.496424</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.600530</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.803126</td>\n",
|
||||
@ -955,6 +1086,8 @@
|
||||
" <td>0.000368</td>\n",
|
||||
" <td>0.496391</td>\n",
|
||||
" <td>0.003181</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.392153</td>\n",
|
||||
" <td>0.115440</td>\n",
|
||||
" <td>4.174741</td>\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": [
|
||||
"<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>Model</th>\n",
|
||||
" <th>RMSE</th>\n",
|
||||
" <th>MAE</th>\n",
|
||||
" <th>precision</th>\n",
|
||||
" <th>recall</th>\n",
|
||||
" <th>F_1</th>\n",
|
||||
" <th>F_05</th>\n",
|
||||
" <th>precision_super</th>\n",
|
||||
" <th>recall_super</th>\n",
|
||||
" <th>NDCG</th>\n",
|
||||
" <th>mAP</th>\n",
|
||||
" <th>MRR</th>\n",
|
||||
" <th>LAUC</th>\n",
|
||||
" <th>HR</th>\n",
|
||||
" <th>HitRate2</th>\n",
|
||||
" <th>HitRate3</th>\n",
|
||||
" <th>Reco in test</th>\n",
|
||||
" <th>Test coverage</th>\n",
|
||||
" <th>Shannon</th>\n",
|
||||
" <th>Gini</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_RP3Beta</td>\n",
|
||||
" <td>3.501158</td>\n",
|
||||
" <td>3.321368</td>\n",
|
||||
" <td>0.315907</td>\n",
|
||||
" <td>0.213088</td>\n",
|
||||
" <td>0.208492</td>\n",
|
||||
" <td>0.242756</td>\n",
|
||||
" <td>0.233476</td>\n",
|
||||
" <td>0.270002</td>\n",
|
||||
" <td>0.382946</td>\n",
|
||||
" <td>0.245988</td>\n",
|
||||
" <td>0.626241</td>\n",
|
||||
" <td>0.604180</td>\n",
|
||||
" <td>0.896076</td>\n",
|
||||
" <td>0.727466</td>\n",
|
||||
" <td>0.538706</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.122655</td>\n",
|
||||
" <td>4.342930</td>\n",
|
||||
" <td>0.959561</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_P3</td>\n",
|
||||
" <td>3.702446</td>\n",
|
||||
" <td>3.527273</td>\n",
|
||||
" <td>0.282185</td>\n",
|
||||
" <td>0.192092</td>\n",
|
||||
" <td>0.186749</td>\n",
|
||||
" <td>0.216980</td>\n",
|
||||
" <td>0.204185</td>\n",
|
||||
" <td>0.240096</td>\n",
|
||||
" <td>0.339114</td>\n",
|
||||
" <td>0.204905</td>\n",
|
||||
" <td>0.572157</td>\n",
|
||||
" <td>0.593544</td>\n",
|
||||
" <td>0.875928</td>\n",
|
||||
" <td>0.685048</td>\n",
|
||||
" <td>0.495228</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.077201</td>\n",
|
||||
" <td>3.875892</td>\n",
|
||||
" <td>0.974947</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_TopPop</td>\n",
|
||||
" <td>2.508258</td>\n",
|
||||
" <td>2.217909</td>\n",
|
||||
" <td>0.188865</td>\n",
|
||||
" <td>0.116919</td>\n",
|
||||
" <td>0.118732</td>\n",
|
||||
" <td>0.141584</td>\n",
|
||||
" <td>0.130472</td>\n",
|
||||
" <td>0.137473</td>\n",
|
||||
" <td>0.214651</td>\n",
|
||||
" <td>0.111707</td>\n",
|
||||
" <td>0.400939</td>\n",
|
||||
" <td>0.555546</td>\n",
|
||||
" <td>0.765642</td>\n",
|
||||
" <td>0.492047</td>\n",
|
||||
" <td>0.290562</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.038961</td>\n",
|
||||
" <td>3.159079</td>\n",
|
||||
" <td>0.987317</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_KNNSurprisetask</td>\n",
|
||||
" <td>0.942531</td>\n",
|
||||
" <td>0.744851</td>\n",
|
||||
" <td>0.090562</td>\n",
|
||||
" <td>0.038031</td>\n",
|
||||
" <td>0.045951</td>\n",
|
||||
" <td>0.060863</td>\n",
|
||||
" <td>0.080258</td>\n",
|
||||
" <td>0.058681</td>\n",
|
||||
" <td>0.090174</td>\n",
|
||||
" <td>0.038552</td>\n",
|
||||
" <td>0.178715</td>\n",
|
||||
" <td>0.515679</td>\n",
|
||||
" <td>0.448568</td>\n",
|
||||
" <td>0.232238</td>\n",
|
||||
" <td>0.123012</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.042569</td>\n",
|
||||
" <td>3.015508</td>\n",
|
||||
" <td>0.989612</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_Baseline</td>\n",
|
||||
" <td>0.949459</td>\n",
|
||||
" <td>0.752487</td>\n",
|
||||
" <td>0.091410</td>\n",
|
||||
" <td>0.037652</td>\n",
|
||||
" <td>0.046030</td>\n",
|
||||
" <td>0.061286</td>\n",
|
||||
" <td>0.079614</td>\n",
|
||||
" <td>0.056463</td>\n",
|
||||
" <td>0.095957</td>\n",
|
||||
" <td>0.043178</td>\n",
|
||||
" <td>0.198193</td>\n",
|
||||
" <td>0.515501</td>\n",
|
||||
" <td>0.437964</td>\n",
|
||||
" <td>0.239661</td>\n",
|
||||
" <td>0.126193</td>\n",
|
||||
" <td>1.000000</td>\n",
|
||||
" <td>0.033911</td>\n",
|
||||
" <td>2.836513</td>\n",
|
||||
" <td>0.991139</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_Random</td>\n",
|
||||
" <td>1.516512</td>\n",
|
||||
" <td>1.217214</td>\n",
|
||||
" <td>0.045599</td>\n",
|
||||
" <td>0.021001</td>\n",
|
||||
" <td>0.024136</td>\n",
|
||||
" <td>0.031226</td>\n",
|
||||
" <td>0.028541</td>\n",
|
||||
" <td>0.022057</td>\n",
|
||||
" <td>0.050154</td>\n",
|
||||
" <td>0.019000</td>\n",
|
||||
" <td>0.125089</td>\n",
|
||||
" <td>0.507013</td>\n",
|
||||
" <td>0.327678</td>\n",
|
||||
" <td>0.093319</td>\n",
|
||||
" <td>0.026511</td>\n",
|
||||
" <td>0.988017</td>\n",
|
||||
" <td>0.192641</td>\n",
|
||||
" <td>5.141246</td>\n",
|
||||
" <td>0.903763</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_I-KNN</td>\n",
|
||||
" <td>1.030386</td>\n",
|
||||
" <td>0.813067</td>\n",
|
||||
" <td>0.026087</td>\n",
|
||||
" <td>0.006908</td>\n",
|
||||
" <td>0.010593</td>\n",
|
||||
" <td>0.016046</td>\n",
|
||||
" <td>0.021137</td>\n",
|
||||
" <td>0.009522</td>\n",
|
||||
" <td>0.024214</td>\n",
|
||||
" <td>0.008958</td>\n",
|
||||
" <td>0.048068</td>\n",
|
||||
" <td>0.499885</td>\n",
|
||||
" <td>0.154825</td>\n",
|
||||
" <td>0.072110</td>\n",
|
||||
" <td>0.024390</td>\n",
|
||||
" <td>0.402333</td>\n",
|
||||
" <td>0.434343</td>\n",
|
||||
" <td>5.133650</td>\n",
|
||||
" <td>0.877999</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_I-KNNBaseline</td>\n",
|
||||
" <td>0.935327</td>\n",
|
||||
" <td>0.737424</td>\n",
|
||||
" <td>0.002545</td>\n",
|
||||
" <td>0.000755</td>\n",
|
||||
" <td>0.001105</td>\n",
|
||||
" <td>0.001602</td>\n",
|
||||
" <td>0.002253</td>\n",
|
||||
" <td>0.000930</td>\n",
|
||||
" <td>0.003444</td>\n",
|
||||
" <td>0.001362</td>\n",
|
||||
" <td>0.011760</td>\n",
|
||||
" <td>0.496724</td>\n",
|
||||
" <td>0.021209</td>\n",
|
||||
" <td>0.004242</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.482821</td>\n",
|
||||
" <td>0.059885</td>\n",
|
||||
" <td>2.232578</td>\n",
|
||||
" <td>0.994487</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Ready_U-KNN</td>\n",
|
||||
" <td>1.023495</td>\n",
|
||||
" <td>0.807913</td>\n",
|
||||
" <td>0.000742</td>\n",
|
||||
" <td>0.000205</td>\n",
|
||||
" <td>0.000305</td>\n",
|
||||
" <td>0.000449</td>\n",
|
||||
" <td>0.000536</td>\n",
|
||||
" <td>0.000198</td>\n",
|
||||
" <td>0.000845</td>\n",
|
||||
" <td>0.000274</td>\n",
|
||||
" <td>0.002744</td>\n",
|
||||
" <td>0.496441</td>\n",
|
||||
" <td>0.007423</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.602121</td>\n",
|
||||
" <td>0.010823</td>\n",
|
||||
" <td>2.089186</td>\n",
|
||||
" <td>0.995706</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_TopRated</td>\n",
|
||||
" <td>1.030712</td>\n",
|
||||
" <td>0.820904</td>\n",
|
||||
" <td>0.000954</td>\n",
|
||||
" <td>0.000188</td>\n",
|
||||
" <td>0.000298</td>\n",
|
||||
" <td>0.000481</td>\n",
|
||||
" <td>0.000644</td>\n",
|
||||
" <td>0.000223</td>\n",
|
||||
" <td>0.001043</td>\n",
|
||||
" <td>0.000335</td>\n",
|
||||
" <td>0.003348</td>\n",
|
||||
" <td>0.496433</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.699046</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.945910</td>\n",
|
||||
" <td>0.995669</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_BaselineUI</td>\n",
|
||||
" <td>0.967585</td>\n",
|
||||
" <td>0.762740</td>\n",
|
||||
" <td>0.000954</td>\n",
|
||||
" <td>0.000170</td>\n",
|
||||
" <td>0.000278</td>\n",
|
||||
" <td>0.000463</td>\n",
|
||||
" <td>0.000644</td>\n",
|
||||
" <td>0.000189</td>\n",
|
||||
" <td>0.000752</td>\n",
|
||||
" <td>0.000168</td>\n",
|
||||
" <td>0.001677</td>\n",
|
||||
" <td>0.496424</td>\n",
|
||||
" <td>0.009544</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.600530</td>\n",
|
||||
" <td>0.005051</td>\n",
|
||||
" <td>1.803126</td>\n",
|
||||
" <td>0.996380</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Self_IKNN</td>\n",
|
||||
" <td>1.018363</td>\n",
|
||||
" <td>0.808793</td>\n",
|
||||
" <td>0.000318</td>\n",
|
||||
" <td>0.000108</td>\n",
|
||||
" <td>0.000140</td>\n",
|
||||
" <td>0.000189</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000214</td>\n",
|
||||
" <td>0.000037</td>\n",
|
||||
" <td>0.000368</td>\n",
|
||||
" <td>0.496391</td>\n",
|
||||
" <td>0.003181</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.000000</td>\n",
|
||||
" <td>0.392153</td>\n",
|
||||
" <td>0.115440</td>\n",
|
||||
" <td>4.174741</td>\n",
|
||||
" <td>0.965327</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"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": {
|
||||
@ -1049,7 +1650,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5"
|
||||
"version": "3.8.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
File diff suppressed because one or more lines are too long
@ -67,8 +67,8 @@ def evaluate(test,
|
||||
def ranking_metrics(test_ui, reco, super_reactions=[], topK=10):
|
||||
|
||||
nb_items=test_ui.shape[1]
|
||||
relevant_users, super_relevant_users, prec, rec, F_1, F_05, prec_super, rec_super, ndcg, mAP, MRR, LAUC, HR=\
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
relevant_users, super_relevant_users, prec, rec, F_1, F_05, prec_super, rec_super, ndcg, mAP, MRR, LAUC, HR, HitRate2, HitRate3=\
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
cg = (1.0 / np.log2(np.arange(2, topK + 2)))
|
||||
cg_sum = np.cumsum(cg)
|
||||
@ -121,7 +121,10 @@ def ranking_metrics(test_ui, reco, super_reactions=[], topK=10):
|
||||
((nb_items-nb_u_rated_items)*nb_u_rated_items)
|
||||
|
||||
HR+=nb_user_successes>0
|
||||
|
||||
|
||||
HitRate2+=nb_user_successes>1
|
||||
|
||||
HitRate3+=nb_user_successes>2
|
||||
|
||||
result=[]
|
||||
result.append(('precision', prec/relevant_users))
|
||||
@ -135,6 +138,9 @@ def ranking_metrics(test_ui, reco, super_reactions=[], topK=10):
|
||||
result.append(('MRR', MRR/relevant_users))
|
||||
result.append(('LAUC', LAUC/relevant_users))
|
||||
result.append(('HR', HR/relevant_users))
|
||||
result.append(('HitRate2', HitRate2/relevant_users))
|
||||
result.append(('HitRate3', HitRate3/relevant_users))
|
||||
|
||||
|
||||
df_result=pd.DataFrame()
|
||||
if len(result)>0:
|
||||
|
Loading…
Reference in New Issue
Block a user