Table of Contents
Assume we created a simple social network for people, which allows them to send messages, read the feed and make posts.
Every user on the platform can interact with the posts by viewing and putting likes on them. But we would like to make our service better and show our users the posts they might like the most.
All the users, posts and feed tabular data are stored in a database as follows:
-
user_data table contains information about users:
- age - Age of a user;
- city - City of a user;
- country - Country of a user;
- exp_group - Experimental group;
- gender - User's gender;
- id - User's id;
- os - Type of OS used by a user;
- source - Source a user came to the platform from
-
post_text_df table contains information about posts:
- id - Unique post’s id;
- text - Textual content of a post;
- topic - Main topic of a post;
-
feed_data tracks a user's interaction with posts:
- timestamp - Time when a user interacted with a post;
- user_id - User's id;
- post_id - Post's id;
- action - Type of action: view or like
- The main objective of this project was to build a web service that predicts and displays top-5 posts to a user in which he might be interested the most. To accomplish that Content-Based recommender system technique was implemented by means of machine learning.
- The idea was also to conduct a simulation of A/B test. For this purpose, all the users were divided into two groups (control and test) as well as two different ML models were trained to get predictions. The control group was exposed to a “weaker” model and the test group – to a “stronger” one.
- Additionally, the recommender system was integrated with a Telegram bot.
- app.py - Runs our web service;
- recommender_bot.py - Runs the telegram bot with recommendations;
- my_models/catboost_control_tfidf.ipynb – A jupyter notebook where a model for the control group was trained;
- my_models/catboost_test_bertemb.ipynb – A jupyter notebook where a model for the test group was trained;
- catboost_model_tfidf – a trained model used for the control group;
- catboost_model_bertemb – A trained model used for the test group.
-
Clone the repo
git clone https://github.com/paverGulyaevich/recommender_3000.git
-
Open app.py and navigate to “project_app” folder by running the following command on the terminal:
cd project_app -
Run
uvicorn app:app –reloadcommand on the terminal to start the service. -
Wait until the message Service is up and running appears.
-
To start the telegram bot execute recommender_bot.py
-
Open the bot.
-
Follow the instructions on the screen.
Distributed under the MIT License. See LICENSE.txt for more information.
