1
$\begingroup$

I'm trying to build a simple book recommendation system, where I don't have any kind of ratings (no comments, no likes, no 1-5 stars, ...).

The information I can use is the following:

  • Book metadata : title, author, published date, model (printed or ebook), genres (one or more).
  • Username.
  • Type : category of interaction made by a user, it can be 'order' (if the user ordered the book) or 'access' (if the user just checked the book).
  • Number : if 'type' = 'access' then this parameter indicates the number of times the user accessed the book.

So I have a DataFrame that looks something like this:

    number       type   username  product  price        model publishing_dt          genres
0        6     access   kerrigan     2345  12.99  printedbook    2020-02-01    fantasy,kids
1        4     access   kerrigan      897  14.95  printedbook    2019-03-05         fantasy
2        1  orderline  45michael    86833   2.65        ebook    2020-02-04      action,war 
3        1  orderline   kerrigan    86833   2.65        ebook    2020-02-04      action,war

My goal is to develop a KNN system to make book recommendations and I can have two types of classifications:

  • Item-based : similarity between books (by genre and author).
  • User-based : similarity between users. Take each user purchases and compare them to other users to find similarities so if userA bought book1, book2 and book3 and userB bought book1, book2 and book4 you can assume that book3 is a good recommendation for userB.

But my doubt here is if I can develop a KNN system combining both technics, so depending on the data I input to it, it decides which solution is the better one.

Is this possible? Can someone point me in a good direction or send me some good tutorials?

EDIT - There are three scenarios:

  1. The user is logged in and there's enough purchase history information.
  2. The user is logged in but he/she is either new or there's not enough purchase history information.
  3. The user is not logged in.

Desired output:

  1. A combination of purchase history and book features (this is the case I don't know how to approach), it should take into account both the book features and the past purchases, maybe it would be a good choice to perform two searches instead of trying to make one.
  2. As there's not enough purchase history information, here the best approach would be to just use book features to make a recommendation.
  3. Same case as before.
$\endgroup$
8
  • $\begingroup$ "depending on the data I input to it, it decides which solution is the better one.", can you give an example of what kind of behaviour you would like to have? $\endgroup$ Mar 23, 2020 at 10:26
  • $\begingroup$ See this answer: datascience.stackexchange.com/questions/63687/…, you need Content-based models. As mentioned, I have implemented using such model using a combination of those resources. I might be able to make the polished notebook I have later (at the moment the tutorial contains private data), but said that you should be able to make something out of them. $\endgroup$ Mar 23, 2020 at 11:47
  • $\begingroup$ @ValentinCalomme I've added an edit, I don't know if it helps to clarify what I'm looking for. $\endgroup$ Mar 24, 2020 at 9:15
  • $\begingroup$ @TwinPenguins I've checked the answer and I think what I'm searching is a combination of both content-based models and collaborative models, as I would like to take into account the purchase history of the user, what I don't know is how to mix both things into one recommender. $\endgroup$ Mar 24, 2020 at 9:16
  • $\begingroup$ @TwinPenguins one thing I've noticed is that when I try to check recsys.py on the answer you've sent me it takes me to this image: [i.stack.imgur.com/IWFfC.png] $\endgroup$ Mar 24, 2020 at 9:25

0

Your Answer

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