A library of recommendation algorithms for the assignment of "Programming Project Databases 2020-2021".
The folder src/algorithm
contain 5 recommendation algorithms:
- Random
- Popularity
- Item Nearest Neighbours (cosine)
- EASE
- Weighted Matrix Factorization (WMF)
You can test them with the provided CLI in main.py
.
Additionally in the file src/util.py
there are common utility functions for manipulating csv files, numpy arrays and scipy sparse arrays for recommendation.
>python3 main.py iknn ./data/interactions.csv --k 100 --normalize
User 8370
History [ 5 6 11 15 19 23 43 54 95 96 102 115 146 148
151 154 156 159 166 182 185 188 196 199 201 207 213 219
220 221 248 265 270 272 312 318 329 340 341 356 357 358
360 367 380 417 466 476 495 496 560 569 577 578 580 582
626 628 670 671 672 678 710 727 795 797 951 953 1013 1026
1064 1189 1249 1403 1586 1680 1839 2069 2329 3498 3934]
recommendations [ 5 188 6 185 37]
scores [0.75590206 0.72380511 0.71297999 0.70977589 0.68067831]
User 11748
History [ 57 74 75 90 96 121 123 125 127 129 130 132 138 140
141 142 143 155 202 223 226 228 232 234 236 237 241 245
251 268 275 310 355 356 380 382 395 400 410 412 416 433
434 437 438 442 444 445 463 488 543 572 574 591 595 600
601 622 634 642 656 663 670 676 699 730 733 736 760 764
765 775 875 938 947 992 995 1000 1025 1051 1053 1060 1075 1079
1084 1085 1087 1090 1091 1093 1095 1096 1099 1104 1118 1120 1127 1130
1163 1166 1169 1171 1214 1248 1276 1315 1317 1319 1321 1324 1325 1326
1351 1365 1394 1425 1441 1455 1475 1522 1523 1525 1527 1528 1530 1563
1572 1578 1583 1608 1614 1619 1636 1641 1647 1662 1694 1697 1730 1739
1740 1814 1816 1819 1822 1833 1834 1837 1845 1851 1866 1915 1920 1925
2036 2041 2052 2098 2107 2117 2119 2141 2216 2218 2235 2241 2260 2276
2281 2318 2323 2344 2362 2403 2476 2483 2488 2490 2504 2513 2566 2583
2600 2666 2685 2796 2802 2957 3046 3057 3063 3086 3093 3140 3165 3318
3359 3377 3386 3399 3451 3496 3497 3521 3526 3548 3550 3553 3571 3577
3605 3638 3657 3714 3732 3733 3798 3927 3941 3947 4006 4013 4027 4029
4041 4043 4100 4117 4127 4142 4162 4267]
recommendations [434 137 596 135 228]
scores [0.93871955 0.88715344 0.83393249 0.81350513 0.80768068]
User 17368
History [ 154 172 176 236 287 306 330 331 332 374 397 411 437 465
512 524 542 544 556 572 602 636 660 692 710 714 727 755
788 789 798 831 914 1157 1259 1264 1267 1287 1297 1350 1427 1476
1491 1515 1702 1874 1878 2103 2160 2199 2207 2352 2404 2425 2542 2597
2662 2738 2746 2754 2792 3120 3123 3541 4024]
recommendations [466 191 174 166 376]
scores [0.28427849 0.25856493 0.25823504 0.25039131 0.2399928 ]
User 950
History [ 1 3 4 5 20 23 37 54 65 100 146 147 148 149
154 156 166 173 174 175 179 182 185 186 188 189 190 193
198 200 201 208 216 226 249 252 253 258 264 270 272 273
274 283 286 289 300 311 340 341 349 355 358 363 364 368
374 383 405 418 447 455 465 466 481 488 490 491 495 508
512 515 520 526 557 578 604 605 612 622 655 658 675 679
706 719 724 730 736 740 741 744 791 805 816 830 853 870
934 1011 1082 1110 1144 1182 1263 1289 1303 1499 1506 1555 1588 1714
1953 2087 2143 2224 2244 2248 2265 2531 2583 2704 2707 2831 3120 3222
3719 3759]
recommendations [146 208 6 5 148]
scores [1.14039124 1.04338577 1.03027084 1.01427813 1.00576703]
User 15257
History [ 6 95 155 189 221 228 234 247 248 253 281 337 340 368
461 464 658 885 1285 1324 1619 1730 4191]
recommendations [146 208 6 173 184]
scores [0.2189981 0.21721212 0.20357215 0.19742866 0.19552239]