I am trying to build a recommendation system to recommend items to users. This is the kind of real-life example I am trying to implement. But anywhere I searched about making a recommendation system it takes that same user-movie-rating dataset and solves that using Matrix Factorization to find the latent factors for each. But my data is different and I am confused about how to approach this.

My data looks like this-

I have 4 datasets:


|item_id |    category       |              description                          |
|593676  |HEALTH_AND_FITNESS | Abs Workout, designed by professional fitness ... |
98599 rows × 3 columns


| uid | device |device_category | state |  city   | network_type |user_lang| space_available |
|94698|SM-M215F|       Mid      | Assam |Dibrugarh|      4G      | en-US   |      94.32      |
294798 rows × 8 columns

| uid | item_id  |   status  |  install_date |
|64190|  593676  |uninstalled|  2022-07-01   |
3767269 rows × 4 columns

| app_use_date | uid  |item_id | time_spent|
|2022-07-31    |185459| 601235 |  2180211  |
7569649 rows × 4 columns

These are the dataset I have. How do I use all these 4 datasets to build a model-based user personalized recommendation system which recommends top 5 item_id to a user? Any rec-sys expert!

  • $\begingroup$ Roughly how many users and how many possible products? $\endgroup$
    – GooJ
    Sep 12, 2022 at 18:48
  • $\begingroup$ @GooJ I have updated the question. If you are asking how many users and products are there in the table $\endgroup$ Sep 12, 2022 at 18:54
  • $\begingroup$ Roughly how much effort are you willing and able to invest into this recommendation system? Anything between '1 person for 1 day' and 'a few hundred developers for 1 year' is possible. Quality of the result will vary accordingly. $\endgroup$
    – quarague
    Sep 13, 2022 at 6:54
  • $\begingroup$ @quarague It's me only and pretty much at least a month. $\endgroup$ Sep 13, 2022 at 7:31

2 Answers 2


100k apps, 300k users - quite the task.

Modern ranking systems typically consist of 3 phases.

  1. Recall (Generate candidates)
  • For each user, reduce the number of applications you could recommend them from 100k down to (roughly!) 100-500. (This number is something to test).
  • Reduce this by building a set of rules, for example, if an application is in the top 50 trending applications - then it probably belongs in this set. Then break this trending rule out by location, device type etc..
  • Other examples would be user-user / user-item collaborative filtering.
  • Get creative with these rules, this will have a big impact down the pipeline. Look at all of the user, and items historic data.
  1. Ranking
  • Here you take the candidates that you generated (100-500), and label them.
  • The label is: Did each user download each application in your forecasting window.
    • So now you may have a labelled dataset with a few positive downloads, and quite a few more negative (assuming people download a handful)
  • Next build features about each user and application. For example, download rate, trending numbers, age, gender, device, features about their interactions, etc...
  • Feed these features and targets into a ranking model. LightGBM Ranker is very popular, and a sensible start.
  1. Post-ranking
  • Use additional rules, that you don't want or don't know how to get your model to learn. For example, you may not want to recommend an application that is NSFW to a certain population. Or you may want to decrease the rank of an application if it is breaking a set of rules, use advertising against ToS etc etc
  • Essentially any post-ranking analysis/rules/models you want to build.

Ranking systems are often thought of as the hardest area of data science.

General tips: Build a feature store so you don't have to recalculate features over and over. Get your time series k-fold train-test split correct. Get your leakage detection in place - it's not a matter of if it will happen, but when ;). Look at existing software.

Note: This approach got me top 1-2% in the Kaggle H&M recommendations competition, and was used by all the top competitors.

  • 1
    $\begingroup$ Thanks for the information. I will give it a go as you have said step by step. I don't know what I will get. This is the first time I am trying to implement a rec-sys, not on the movie rating dataset. $\endgroup$ Sep 13, 2022 at 7:34
  • $\begingroup$ Best of luck. I'd strongly encourage you to slowly build up the complexity. Aim to get a baseline as quick as possible so you can compare. $\endgroup$
    – GooJ
    Sep 13, 2022 at 11:00
  • $\begingroup$ Hi! I need some advice. I am building the system following your steps. The user metadata size is so large. It takes a lot of time to make the interaction matrix. I am wondering if you can tell me how I can reduce the number of users. Or is it even good to reduce the number of users? $\endgroup$ Sep 19, 2022 at 7:12
  • $\begingroup$ For a more in depth answer, you could ask a new question. A few tricks you can use: 1) Batches. 2) Sparse matrices. Focus on (1), think through your problem and work out how you can batch up the problems you are trying to solve. Get creative. For example, you could find the 1000 most similar users through clustering -> you may get a good 95% solution. Most calculations don't require a full user-app interaction matrix. $\endgroup$
    – GooJ
    Sep 19, 2022 at 9:35

One option is collaborative filtering (CF) which recommends items based on similar interactions across different users.

The first step is to reorganize your data into a user-by-item (i.e., app) matrix with cell values representing if the user has used the app or not. Then build a model by finding the similarity between all pairs of items. Since your data is binary, hamming distance can be used. Different distance metrics can be used for different cell values. For example, you may have more success with time-spent-in-app for cell values.

Lastly, most similar items can be predicted - "People who have used similar apps, have also used this app."


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.