debiasing-item2item

Debiasing Item-to-Item Recommendations With Small Annotated Datasets

This is the code for our RecSys '20 paper. Other materials can be found here:

Setup

This assumes that you have a recent Anaconda distribution of Python 3 installed. To install the dependencies,

conda env create -f environment.yml

Then, activate your new environment

conda activate item2item

and get the datasets

python 0_get_datasets.py

Running the demo

To run the command-line demo that allows you to retrieve item-to-item recommendations interactively,

python 1_run_demo.py

Then, follow the prompts

Input (partial) movie title [empty to quit]: toy
option #
0              Toy Story (1995)
1            Toy Story 2 (1999)
2            Toy Story 3 (2010)
3                   Toys (1992)
4       Babes in Toyland (1961)
5           Toy Soldiers (1991)
6               Toy, The (1982)
7            Toy Story 4 (2019)
8       Babes in Toyland (1934)
9    Toy Story of Terror (2013)

Input option (0-10) [empty to exit]: 0
Recommendations for  Toy Story (1995)
             DebiasedModel                                                      ItemKNN
                     title     score                                              title     score
0       Toy Story 2 (1999) -1.319431                                 Toy Story 2 (1999)  0.632260
1       Toy Story 3 (2010) -1.382858         Willy Wonka & the Chocolate Factory (1971)  0.554588
2      Finding Nemo (2003) -1.532166                          Back to the Future (1985)  0.547485
3  Incredibles, The (2004) -1.544819                              Monsters, Inc. (2001)  0.542195
4    Monsters, Inc. (2001) -1.571283                              Lion King, The (1994)  0.541657
5             Shrek (2001) -1.627429                               Bug's Life, A (1998)  0.538624
6           Shrek 2 (2004) -1.628034               Independence Day (a.k.a. ID4) (1996)  0.535614
7     Bug's Life, A (1998) -1.665477          Star Wars: Episode IV - A New Hope (1977)  0.535263
8       Ratatouille (2007) -1.672807                                     Aladdin (1992)  0.534045
9                Up (2009) -1.722887  Star Wars: Episode VI - Return of the Jedi (1983)  0.532928

Running the baselines

First, fit the models and pick the best on the validation set:

python 2a_find_best.py

Then, get the test set performances:

python 2b_eval_on_test.py

GitHub

https://github.com/microsoft/debiasing-item2item