Code Monkey home page Code Monkey logo

mlops_recsys_ods's Introduction

ods and MTS RecSys Course Competition 4th place solution

Link to competition at ods.ai

Me describing the solution at MTS RecSys meetup

Article about the dataset which we wrote with co-authors and presented at the ACM RecSys CARS Workshop 2022

Competition objective and result

The competition was conducted on MTS Kion streaming service dataset with user-item interactions over a 6 months period and both users and items features. The task was to make 10 recommendations for all users in a test period (1 week). The metric in the competition was map@10.

Baseline solution was a simple top weekly items recommendation for all users and provided 0,091 on public leaderboard.

With a two-stage model of implicit recommendations and gradient boostig I was able to achieve 0,115 and a 4th place on both public and private leaderboard.

End-2-end solution

You can use the following script to reproduce my solution:

pip install -r requirements.txt
snakemake --cores all

Solution description

My solution included a two-stage model. I used item-item CF from implicit library to generate candidates with their scores and Catboost classifier to predict final ranks with classification objective. Recommendations for cold users were made with Popular items.

Implicit model parameters were chosen on sliding time window cross validation. The best scores were achieved by Cosine recommender model, taking only last 20 interactions for each user. 100 candidates with their scores were generated for each user, filtering all items that user had interactions with.

Implicit candidates were calculated for the last 14 days of the interactions. Then catboost model was trained on positive interactions from the candidates list on last 14 days. Random negative sampling was applied.

For final submission implicit candidates and catboost predictions were recalculated on the whole dataset.

EDA

Please look at Kion_EDA.ipynb for my analysis.

Validation scheme for a two-stage model

Exploratory data analysis showed anomalies in weekly distributions of interactions. Also series interactions history was erased from the dataset, leaving only the last interaction between each item for user. Because of this only the last one or two weeks of the dataset were somehow close to the leaderboard. This was a real problem for validating a two-stage model. My solution was to train the model on last 14 days of the dataset and validate the ensemble on the previous week and on the next week (which was separated for the leaderboard). Validation scheme

Features of the Catboost model

Catboost feature importance

The following features were used in the model.

First-level model scores:

  • Implicit scores

Items stats:

  • Interactions counts: in last 7 days, in all time
  • Timestamp of interactions: standard deviation, 95% quantile difference in days with current day, median differece in days with current day
  • Trend slope
  • Female watchers fraction in interactions, male watchers fraction in interactions
  • Young audience fraction in interactions (younger then 35), older audience fraction in interactions (older then 35)

Item content features:

  • Age rating
  • Release novelty
  • 3 values for genres of the item: minimum, maximum and median of all item genres, encoded with label count method.
  • 1 value for countries of the item: maximum of all countries of the item, encoded with label count method.
  • 1 value for studios of the item: maximum of all studios of the item, encoded with label count method.
  • Content type (movie / series)
  • "For kids" boolean feature

User stats:

  • User interactions counts: in last 14 days, in all time

User features:

  • Sex
  • Age
  • Income
  • "Kids flag" boolean feature

Shap values

mlops_recsys_ods's People

Contributors

blondered avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.