Code for 'Collaborative Deep Learning for Recommender Systems' - SIGKDD
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

This is the code for CDL (collaborative deep learning). It consists of two parts: a matlab component and a C++ component.

To run this code you need to make sure:

  1. you have the mult_nor.mat file located in cdl-release/example (can be downloaded from
  2. you have matlab with GPU support
  3. you have installed the GSL library (see

After installing GSL, please remember to add the path of the dynamic library (the directory with files like to LD_LIBRARY_PATH in your .bashrc. Or you can directly change the code in cdl.m around Line 586 where LD_LIBRARY_PATH is exported.

To save the pain of handling memory and variables in mex, we directly compiled a C++ program for the updates of U and V and call the program from matlab. If your program runs without trouble, congratulations! If not, you may have to re-compiled the C++ component which is in the folder 'ctr-part'. You will need to install the GSL before doing that.

To quickly run the program you can directly call the cdl_main.m.

To quickly know what CDL is doing click on collaborative-dl.ipynb (demo in this notenook uses the MXNet-version code, not this matlab/C++ version).

MXNet version for simplified CDL:


Slides: and

Other implementations (third-party):

Tensorflow code by gtshs2.

Keras code by zoujun123.

Python code by xiaoouzhang.


Collaborative Deep Learning for Recommender Systems

  author    = {Hao Wang and
               Naiyan Wang and
               Dit{-}Yan Yeung},
  title     = {Collaborative Deep Learning for Recommender Systems},
  booktitle = {SIGKDD},
  pages     = {1235--1244},
  year      = {2015}