This repository is home to the source code implemented for Interactive Data Visualization for a better understanding of Recommender Systems, Master Thesis by Dennis Leszkowicz, IT-University of Copenhagen, Denmark (January 2019).
The source code is two fold, first part is a Flask web application that implements the recommender system described in the paper. The second part is a collection of notebooks and scripts that shows how the system came along, making it possible to recreate the needed data structures from scratch.
Thanks to Ben Frederickson for the Implicit library
Thanks to Òscar Celma for creating the Last.fm 360K Users Dataset. The dataset can be downloaded here.
A cleaned Last.fm dataset in hdf5 used for this project has been borrowed from Ben Frederickson, more info here.
This project has been developed in Python 3.7 in anaconda virtual environment.
conda create --name <envname> python=3.7
conda activate <envname>
pip install -r requirements.txt
Dendencies included in requirements.txt
flask
h5py
implicit
Jinja2
markupsafe
matplotlib
numpy
pylast
redis
scipy
seaborn
tables
tqdm
wordcloud
Additionally make sure to install Jupyter notebook for the notebook .ipynb
collection.
To download the needed data there are two options:
Option A (quick): Running the shell script sh download_data.sh
will download and place all the aggregated data in flaskapp/data/
Option B (slow): Run scripts located in scripts/
folder to recreate the data structures used for the webapp. This process takes hours, and requires you to:
-
Download the lastfm dataset
lastfm_360k.hdf5
here and place it inflaskapp/data/
. -
Download
lastfm_tags_cleaned.csv
dataset here and place it hereflaskapp/data/
.
In order to recreate the data structures used for this project,.py
script in following order.
-
01make_user_profile_dict.py
-
02make_tag_aggregations.py
# set to True if development mode, otherwise production mode.
dev_mode = False
In order to run debug mode in the Flask enviroment this variable is set dev_mode = True
in app.py
. This ensures that the debugger and hot code-reloading is on.
-
start the redis server by runnning
redis-server
. -
run
python app.py
from theflaskapp/
folder.
or alternatively set export FLASK_ENV=development
/ export FLASK_ENV=deployment
and run flask run
NB! app.py
should run just fine.
This will run the web application on http://127.0.0.1:6543/
docker-compose up -d --build
This will run the web application on http://127.0.0.1:6543/
to stop the service run:
docker-compose stop