Recommender system for casino

The recommender system predicts in which games a user might want to play in an online casino.

Algorithm

The system uses a hybrid weighted model that consists of 3 inner algorithms.

where ri is an inner recommender and ci is the corresponding coefficient. This logic is implemented in HybridRecommender.

All recommenders are memory-based. They use a cosine-similarity matrix. All of them use CosineRecommender that computes predictions using cosine-similarity matrix.

Collaborative-filtering recommender

It uses user-item matrix (where m[u, g]=k means that user u played in game g k times) to compute an item-item similarity matrix. Data preprocessing for this part can be found in user_data_preprocessing.py

Content-based recommenders

There are 2 content-based recommenders. The first is based on data from master_game_features.csv and the second is based on data from game_feature_derived_enc.csv. They have pretty similar logic when data from corresponding csv files are used to compute an item-item similarity matrix. Data preprocessing for this part can be found in game_data_preprecessing.py

Set up

  • Install Python 3.8
  • Create and activate virtual environment
  • pip install -U -r requirements.txt
  • Configure data paths and other settings in config.yml
  • Run training via python train_pipeline.py

Training

The whole training pipeline can be found in train_pipeline.

An example of searching coefficients for the hybrid model can be found in train_eval.

Evaluation

Test dataset creation

Metrics calculation

  • Compute prediction using user-item matrix from the previous part.
  • Compute Precision@K metric using "labels" part from the previous part.

Metrics

0.457 Precision@5 best result from train_eval