Simple Recommendation System in Python3+ (Using Collaborative Filtering)
Installation
pip install recommendation_system
Example Usage
from recommendation_system import complete_recommendation_table
import pandas as pd
Y_df = pd.DataFrame({' Bob' : [5 , ' ?' , 4 ], ' Cathy' : [5 , 4 , ' ?' ], \
' Dave' : [2 , 5 , 5 ]}, index = [' Toy Story' , \
' Despicble Me' , ' Spiderman' ])
output = complete_recommendation_table(Y_df, len (Y_df) + 1 , \
unknown = ' ?' , max_value = 5 , min_value = 0 , regularization_coeff = 0.2 )
print (output)
Example Output
Assume an input table that looks like this:
|Movie /User | Bob | Cathy | Dave |
| Toy Story | 5 | 5 | 2 |
| Despicble Me | ? | 4 | 5 |
| Spiderman | 4 | ? | 5 |
The output after filling in the '?' would look something like this:
|Movie /User | Bob | Cathy | Dave |
| Toy Story | 4.808920 | 4.917348 | 2.118293 |
| Despicble Me | 3.998761 | 3.874179 | 4.816824 |
| Spiderman | 3.818917 | 3.744278 | 4.857076 |
The function 'complete_recommendation_table' fills all unknown values('?') with the predictions