Building a Deep-Learning-Based Movie Recommender System

With the continuous development of network technology and the ever-expanding scale of e-commerce, the number and variety of goods grow rapidly and users need to spend a lot of time to find the goods they want to buy. This is information overload. To solve this problem, the recommendation system came into being.

The recommendation system is a subset of the Information Filtering System, which can be used in a range of areas such as movies, music, e-commerce, and Feed stream recommendations. The recommendation system discovers the user’s personalized needs and interests by analyzing and mining user behaviors and recommends information or products that may be of interest to the user. Unlike search engines, recommendation systems do not require users to accurately describe their needs but model their historical behavior to proactively provide information that meets user interests and needs.

In this article we use PaddlePaddle, a deep learning platform from Baidu, to build a model and combine Milvus, a vector similarity search engine, to build a personalized recommendation system that can quickly and accurately provide users with information that might be of interest to them.

Data Preparation

We take MovieLens Million Dataset (ml-1m) [1] as an example. The ml-1m dataset contains 1,000,000 reviews of 4,000 movies by 6,000 users, collected by the GroupLens Research lab. The original data includes feature data of the movie, user feature, and user rating of the movie, you can refer to ml-1m-README [2].

ml-1m dataset includes 3 .dat articles: movies.dat、users.dat and ratings.dat.movies.dat includes movie’s features, see example below:

MovieID::Title::Genres

1::ToyStory(1995)::Animation|Children’s|Comedy

This means that the movie id is 1, and the title is 《Toy Story》, which is divided into three categories. These three categories are animation, children, and comedy.

users.dat includes user’s features, see example below:


UserID::Gender::Age::Occupation::Zip-code
1::F::1::10::48067

This means that the user ID is 1, female, and younger than 18 years old. The occupation ID is 10.

ratings.dat includes the feature of movie rating, see example below:


UserID::MovieID::Rating::Timestamp
1::1193::5::978300760

That is, the user 1 evaluates the movie 1193 as 5 points.

Fusion Recommendation Model

In the film personalized recommendation system, we used the Fusion Recommendation Model [3] which PaddlePaddle has implemented. This model is created from its industrial practice.

  •  First, take user features and movie features as input to the neural network, where:

a. The user features incorporate four attribute information: user ID, gender, occupation, and age.

b. The movie feature incorporates three attribute information: movie ID, movie type ID, and movie name.

  • For the user feature, map the user ID to a vector representation with the dimension size of 256, enter the fully connected layer, and do similar processing for the other three attributes. Then the feature representations of the four attributes are fully connected and added separately.
  •  For movie features, the movie ID is processed like the user ID. The movie type ID is directly input into the fully connected layer in the form of a vector, and the movie name is represented by a fixed-length vector using a text convolutional neural network. The feature representations of the three attributes are then fully connected and added separately.
  • After obtaining the vector representation of the user and the movie, calculate the cosine similarity of them as the score of the personalized recommendation system. Finally, the square of the difference between the similarity score and the user’s true score is used as the loss function of the regression model.

System Overview

Combined with PaddlePaddle’s fusion recommendation model, the movie feature vector generated by the model is stored in the Milvus vector similarity search engine, and the user feature is used as the target vector to be searched. A similarity search is performed in Milvus to obtain the query result as the recommended movies for the user.

The inner product (IP) method is provided in Milvus to calculate the vector distance. After normalizing the data, the inner product similarity is consistent with the cosine similarity result in the fusion recommendation model.

Application of Personalized Recommender System

There are three steps in building a movie recommendation system with Milvus, details on how to operate please refer to Milvus Bootcamp [4].

Step 1:Model Training

# run train.py
$ python train.py

Running this command will generate a model recommender_system.inference.model in the directory, which can convert movie data and user data into feature vectors, and generate application data for Milvus to store and retrieve.

Step 2Data Preprocessing

# Data preprocessing, -f followed by the parameter raw movie data file name
$ python get_movies_data.py -f movies_origin.txt

Running this command will generate test data movies_data.txt in the directory to achieve the pre-processing of movie data.

Step 3:Implementing Personal Recommender System with Milvus

# Implementing personal recommender system based on user conditions
$ python infer_milvus.py -a <age>-g <gender>-j <job>[-i]

Running this command will implement personalized recommendations for specified users.

The main process is:

  • Through the load_inference_model, the movie data is processed by the model to generate a movie feature vector.
  • Load the movie feature vector into Milvus via milvus.insert.
  • According to the user’s age/gender/occupation specified by the parameters, it is converted into a user feature vector, milvus.search_vectors is used for similarity retrieval, and the result with the highest similarity between the user and the movie is returned.

Prediction of the top five movies that the user is interested in:

TopIdsTitleScore
03030Yojimbo2.9444923996925354
13871Shane2.8583481907844543
23467Hud2.849525213241577
31809Hana-bi2.826111316680908
43184Montana2.8119677305221558

Summary

By inputting user information and movie information to the fusion recommendation model we can get matching scores, and then sort the scores of all movies based on the user to recommend movies that may be of interest to the user. This article combines Milvus and PaddlePaddle to build a personalized movie recommendation system. Milvus, a vector search engine, is used to store all movie feature data, and then similarity retrieval is performed on user features in Milvus. The search result is the movie ranking recommended by the system to the user.

Milvus [5] vector similarity search engine is compatible with various deep learning platforms, searching billions of vectors with only millisecond response. You can explore more possibilities of AI applications with Milvus with ease!

References

[1] MovieLens Million Dataset (ml-1m): http://files.grouplens.org/datasets/movielens/ml-1m.zip

[2] ml-1m-README: http://files.grouplens.org/datasets/movielens/ml-1m-README.txt

[3] Fusion Recommendation Model by PaddlePaddle: https://www.paddlepaddle.org.cn/documentation/docs/zh/beginners_guide/basics/recommender_system/index.html#id7

[4] Bootcamp: https://github.com/milvus-io/bootcamp/blob/master/demo/recommender_system

[5] Milvus: https://milvus.io/en/

 

Original post: https://www.datasciencecentral.com/profiles/blogs/building-a-deep-learning-based-movie-recommender-system

112 comentários em “Building a Deep-Learning-Based Movie Recommender System

  1. I am the business owner of JustCBD brand (justcbdstore.com) and I’m presently aiming to expand my wholesale side of business. I am hoping someone at targetdomain give me some advice . I considered that the most effective way to accomplish this would be to talk to vape shops and cbd retailers. I was really hoping if anyone could recommend a trusted web site where I can buy Vape Shop B2B Database I am currently taking a look at creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not sure which one would be the very best selection and would appreciate any advice on this. Or would it be easier for me to scrape my own leads? Suggestions?

  2. I am the owner of JustCBD Store label (justcbdstore.com) and I am currently seeking to broaden my wholesale side of company. It would be great if someone at targetdomain is able to provide some guidance . I thought that the very best way to accomplish this would be to talk to vape shops and cbd retailers. I was hoping if someone could suggest a reputable site where I can get UK Vape Shop Database I am already taking a look at creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not exactly sure which one would be the best choice and would appreciate any assistance on this. Or would it be easier for me to scrape my own leads? Suggestions?

  3. This is the perfect site for everyone who wants to understand this topic. You know so much its almost tough to argue with you (not that I personally would want to…HaHa). You certainly put a fresh spin on a subject that’s been discussed for ages. Wonderful stuff, just great!

  4. This is the right web site for anybody who wishes to find out about this topic. You know a whole lot its almost hard to argue with you (not that I personally will need to…HaHa). You definitely put a fresh spin on a subject which has been discussed for a long time. Wonderful stuff, just excellent!

  5. An interesting discussion is definitely worth comment. I do think that you ought to publish more about this subject, it may not be a taboo matter but usually people don’t speak about such issues. To the next! Best wishes!!

  6. Right here is the perfect blog for anybody who wants to understand this topic. You realize a whole lot its almost hard to argue with you (not that I really would want to…HaHa). You definitely put a fresh spin on a subject that has been written about for ages. Excellent stuff, just great!

  7. Having read this I believed it was extremely enlightening. I appreciate you spending some time and effort to put this informative article together. I once again find myself spending way too much time both reading and posting comments. But so what, it was still worthwhile!

  8. After I initially left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and now whenever a comment is added I get four emails with the same comment. Perhaps there is a way you can remove me from that service? Kudos!

  9. Hi! I could have sworn I’ve visited this website before but after looking at some of the posts I realized it’s new to me. Regardless, I’m certainly happy I stumbled upon it and I’ll be book-marking it and checking back regularly!

  10. Howdy! This article could not be written much better! Looking through this post reminds me of my previous roommate! He constantly kept preaching about this. I’ll forward this article to him. Fairly certain he’ll have a good read. I appreciate you for sharing!

  11. You are so awesome! I don’t believe I have read through something like that before. So good to discover another person with some genuine thoughts on this topic. Seriously.. thank you for starting this up. This site is something that’s needed on the internet, someone with a bit of originality!

  12. Great beat ! I would like to apprentice while you amend your website, how could i subscribe for a blog site?
    The account aided me a acceptable deal. I had been a little
    bit acquainted of this your broadcast offered brilliant transparent concept

  13. After going over a few of the blog posts on your blog, I really appreciate your technique of blogging. I bookmarked it to my bookmark webpage list and will be checking back in the near future. Please check out my website too and tell me how you feel.

  14. Hi, I do believe this is a great website. I stumbledupon it 😉 I’m going to come back yet again since i have book-marked it. Money and freedom is the best way to change, may you be rich and continue to help other people.

  15. This is the right web site for anyone who wants to find out about this topic. You realize a whole lot its almost hard to argue with you (not that I actually will need to…HaHa). You definitely put a brand new spin on a subject that’s been discussed for a long time. Wonderful stuff, just great!

  16. Hi! I could have sworn I’ve been to this blog before but after looking at many of the posts I realized it’s new to me. Regardless, I’m certainly pleased I came across it and I’ll be book-marking it and checking back frequently!

  17. I need to to thank you for this great read!! I definitely loved every bit of it. I have got you book marked to look at new stuff you post…

  18. Aw, this was an incredibly nice post. Taking a few minutes and actual effort to make a really good article… but what can I say… I put things off a whole lot and don’t manage to get nearly anything done.

  19. May I just say what a relief to uncover an individual who actually understands what they’re talking about online. You definitely understand how to bring an issue to light and make it important. More and more people should read this and understand this side of your story. I can’t believe you aren’t more popular given that you most certainly possess the gift.

  20. The next time I read a blog, Hopefully it does not fail me just as much as this particular one. I mean, Yes, it was my choice to read through, but I genuinely believed you would probably have something helpful to say. All I hear is a bunch of whining about something you could fix if you weren’t too busy searching for attention.

  21. Right here is the right web site for anybody who wants to find out about this topic. You know so much its almost hard to argue with you (not that I really would want to…HaHa). You certainly put a brand new spin on a subject that has been written about for many years. Wonderful stuff, just excellent!

  22. This is the perfect site for anyone who really wants to find out about this topic. You realize a whole lot its almost hard to argue with you (not that I personally would want to…HaHa). You certainly put a fresh spin on a topic that has been written about for years. Great stuff, just great!

  23. I really love your website.. Excellent colors & theme. Did you create this amazing site yourself? Please reply back as I’m hoping to create my own blog and would like to learn where you got this from or exactly what the theme is called. Many thanks!

  24. Hi there! This post couldn’t be written any better! Looking through this post reminds me of my previous roommate! He constantly kept talking about this. I most certainly will forward this article to him. Fairly certain he’s going to have a very good read. Thanks for sharing!

  25. I’m amazed, I have to admit. Rarely do I come across a blog that’s both educative and engaging, and without a doubt, you have hit the nail on the head. The issue is something not enough men and women are speaking intelligently about. I am very happy I came across this during my hunt for something regarding this.

  26. Hi, I do think this is a great website. I stumbledupon it 😉 I may return once again since i have saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to help others.

  27. Having read this I believed it was extremely enlightening. I appreciate you taking the time and effort to put this content together. I once again find myself spending a lot of time both reading and leaving comments. But so what, it was still worthwhile!

  28. Everything is very open with a really clear explanation of the issues. It was definitely informative. Your website is very helpful. Many thanks for sharing!

  29. I’ve been surfing online more than 3 hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my opinion, if all site owners and bloggers made good content as you did, the internet will be a lot more useful than ever before.|

  30. That is a very good tip especially to those fresh to the blogosphere. Brief but very precise info… Thanks for sharing this one. A must read post!

  31. Achieving your fitness goal doesn’t need a certified personal trainer or an expensive gym memberships, it is not hard to exercise at home. It’s easy to go down a training and fitness rabbit hole, however, when you are looking for the best home exercise equipment to outfit your personal home gym.

  32. Amazing blog! Is your theme custom made or did
    you download it from somewhere? A design like yours with a few simple adjustements
    would really make my blog shine. Please let me know where you got your design. With thanks

  33. Awesome things here. I’m very satisfied to look your article.

    Thanks a lot and I am taking a look forward to touch you.
    Will you please drop me a mail?

  34. The very next time I read a blog, I hope that it does not fail me as much as this one. I mean, I know it was my choice to read, nonetheless I genuinely thought you’d have something interesting to say. All I hear is a bunch of whining about something you can fix if you were not too busy seeking attention.

  35. Does your website have a contact page? I’m having trouble locating it but,
    I’d like to shoot you an e-mail. I’ve got some creative ideas for your blog you might be interested in hearing.
    Either way, great website and I look forward to seeing it improve
    over time.

  36. Hi there! I could have sworn I’ve been to your blog before but after looking at some of the articles I realized it’s new to me.
    Nonetheless, I’m definitely happy I stumbled upon it and
    I’ll be bookmarking it and checking back regularly!

  37. I do not know whether it’s just me or if perhaps everybody else
    experiencing issues with your site. It appears as if some of the text in your content are running off the screen. Can someone else please provide feedback and
    let me know if this is happening to them as well?
    This may be a problem with my web browser because I’ve had this
    happen previously. Thanks

  38. I’m amazed, I have to admit. Seldom do I come across a blog that’s both educative and engaging, and without a doubt, you’ve hit the nail on the head. The issue is something which not enough men and women are speaking intelligently about. I am very happy that I came across this in my hunt for something regarding this.

  39. Can I simply just say what a relief to discover a person that genuinely knows what they are talking about online. You definitely realize how to bring a problem to light and make it important. More people have to look at this and understand this side of your story. I was surprised that you aren’t more popular since you surely possess the gift.

  40. Good day! I know this is kinda off topic but I was wondering which blog platform are
    you using for this site? I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at alternatives for
    another platform. I would be great if you could point
    me in the direction of a good platform.

  41. Oh my goodness! Impressive article dude! Thank you so much, However I am going through problems with your RSS. I don’t understand the reason why I cannot subscribe to it. Is there anyone else having the same RSS issues? Anyone that knows the answer will you kindly respond? Thanks!!

  42. Right here is the right webpage for everyone who wants to find out about this topic. You know so much its almost hard to argue with you (not that I really would want to…HaHa). You certainly put a brand new spin on a topic that’s been written about for a long time. Excellent stuff, just great!

  43. I blog quite often and I truly appreciate your information. The article has really peaked my interest. I’m going to bookmark your site and keep checking for new details about once a week. I subscribed to your RSS feed too.

  44. I must thank you for the efforts you have put in writing this site. I really hope to view the same high-grade content from you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal blog now 😉

  45. Hello there! I could have sworn I’ve been to this site before but after browsing through a few of the posts I realized it’s new to me. Anyways, I’m definitely pleased I discovered it and I’ll be bookmarking it and checking back regularly!

  46. Nice post. I learn something new and challenging on blogs I stumbleupon on a daily basis. It’s always interesting to read articles from other writers and practice a little something from other websites.

  47. A ‘contributed’ method is primarily based on the proportion contributed to the pot and who has produced the contributions. The emblem was not just sticker, it was really produced into the chip itself.

  48. Hi, I do think this is an excellent site. I stumbledupon it 😉 I am going to come back once again since i have book marked it. Money and freedom is the best way to change, may you be rich and continue to help others.

  49. When I initially left a comment I seem to have clicked the -Notify me when new comments are added- checkbox and from now on every time a comment is added I receive 4 emails with the exact same comment. Is there an easy method you can remove me from that service? Thanks!

  50. An impressive share! I’ve just forwarded this onto a colleague who has been doing a little research on this. And he actually ordered me lunch because I found it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanks for spending some time to discuss this matter here on your blog.

  51. I just want to mention I’m all new to blogging and site-building and honestly savored your website. More than likely I’m likely to bookmark your blog . You certainly have excellent articles. Thanks a lot for revealing your blog.

  52. Yesterday, while I was at work, my cousin stole my iPad and tested to see if it can survive a thirty foot drop, just so she can be a youtube sensation. My apple ipad is now broken and she has 83 views.
    I know this is totally off topic but I had to share it with
    someone!

Leave a Reply

Your email address will not be published. Required fields are marked *