Project for a Machine Learning Engineering course at Warsaw University of Technology.
Program for generating playlist recommendations. Can be run either using Docker container or Flask with Python3
- Place folder with data - "IUM_Zad_03_01_v4" at the same level as other folders e.g. app
- Run the main file:
python3 app/main.py
- Build the docker image
docker image build -t ium_pozytywka . - Run a new container
docker run -p 5000:5000 -d ium_pozytywka - Test with example curl shown at the bottom. As the port-binding was used, the application will be visible also under localhost:5000
Steps:
- Install Flask:
pip install Flask - Run the server on localhost:
python3 app/main.py
- Use curl for making test POST requests
- Template for json content:
{
"user_ids": [
x, y, z
]
}
users - a list of users' ids
- Example curl:
# On Linux
curl -i -X POST -H "Content-Type: application/json" -d "{"users": [101, 103, 104]}" http://127.0.0.1:5000/playlist_names
# On Windows
curl -i -X POST -H "Content-Type: application/json" -d "{\"users\": [101, 103, 104]}" http://127.0.0.1:5000/playlist_names
- By default the server should expose the port 5000
- In return the response should include names of the songs chosen for the playlist and the received ids of users
Running experiment A/B for two models: the custom one implemented in the application and a random one that generates a list of track ids of required length. Experiment can be run either with default parameters: 20 iterations for each number of users given for the playlist creation. Numbers of users by default are 3, 6, 9.
python3 experiment/experiment_AB.py
Example for custom parameters
python3 experiment/experiment_AB.py 3 2 3 4
First parameter is the number of iterations and the rest are the counts of users for which tests are supposed to be run.
Experiment results will be saved to an output file test_results.txt In the meantime all steps of the experiment with current state and results will be logged with the set importance to "info".
Automated tests are created both for the utility functions as well as the main functionality of the model. Commands for running the tests:
python3 tests/test_models.py
python3 tests/test_util_funcs.py
Team:
- Aleksandra Sypula
- Eryk Sztanga