C++ Implementation of recommender system with collaborative filtering.
-
Keep project files in one folder.
-
compile using command
make
.
To compile without using the makefile, type the following command.
g++ -std=c++11 recommender.cpp -o recommender.exe
(Note that -std=c++11 option is must be given in g++.)
- Run using following command.
./recommender.exe [base file name] [test file name]
Collaborative filtering (CF) algorithm is the most prominent approach to generate recommendations.
Advantages
- used by large, commercial e-commerce sites
- well-understood, various algorithms and variations exist
- applicable in many domains (book, movies, DVDs, ..)
Basic assumption and idea
- Users give ratings to catalog items (implicitly or explicitly)
- Customers who had similar tastes in the past, will have similar tastes in the future
Approach
- Consider user c
- Find set D of other users whose ratings are “similar” to c’s ratings
- Estimate user’s ratings based on ratings of users in D
Input
- A matrix of given user–item ratings
Output
- A (numerical) prediction indicating to what degree the current user will like or dislike a certain item.
- A top-N list of recommended items.
Method
There are two types of collaborative filtering.
- User-based
- Item-based
-
Note that I use c++11, not c++. therefore -std=c++11 option is must be given in g++.
-
self test result
u1 RSME: 0.9094779
u2 RSME: 0.8995277
u3 RSME: 0.8900281
u4 RSME: 0.8941476
u5 RSME: 0.8968278