Build a Movie Recommender - Machine Learning for Hackers #4
Key Takeaways
This video demonstrates building a movie recommender system using Amazon's Deep Scalable Sparse Tensor Network Engine (Destiny) library in C++, training a neural network on the MovieLens dataset, and deploying it on AWS for prediction.
Full Transcript
hey Siri any songs you'd recommend the black or the berry by Kendrick Lamar Good pick why that one because the police hello world welcome to sty in this episode we're going to build a movie recommender system recommender systems are all around us almost every single major service on the internet uses them to show you things you like based on your interest sometimes it's so subtle you don't even notice they help personalize content on the web which makes users happy which makes companies money I choose Rich every time the two most ubiquitous types of recommender systems are content based and collaborative content based systems focus on each user individually it looks at the items you've already expressed interest in Via likes and ratings and Records their keywords attributes and tags then your profile is gradually built with these attributes once your profile is built the system will start recommending items you like with similar attributes to the ones you've already expressed interest in so if you're on an e-commerce site and you buy a bunch of Nickelback t-shirts those items will have tags like worst band ever and stupid based on that content the system will suggest similarly tagged items for you like cre t-shirts and Walmart brand guitar then there are collaborative systems these are the most ubiquitous types of recommender systems a collaborative system recommends you items based on what other similar users have expressed interest in if you really like base jumping and constantly buy Bas jumping gear online the system will find users who have similar purchase history it can recommend other items they've bought that you haven't it's likely that you'll be into those products as well so we're going to build an app that can recommend movies you'd like in 10 lines of C++ using Amazon's newly released ml Library called Deep scalable sparse tensor Network engine or destiny we've got to think of a better name our model will be a neural network because depending on how deep we make it and how much data we feed it it's just going to outperform everything else let's be real then we're going to train it in the cloud using AWS because I ain't got time to train this on my MacBook Destiny is what Amazon build for production use specifically to recommend products to customers that they might like it's optimized for sparse data and multi-gpu computation data is sparse if it contains a lot of zeros as not a whole lot of valuable information Rex usually operate on sparse data not everything is connected but you can manage to find some valuable links between people and items most ml libraries Implement data parallel training as in it splits training data across multiple gpus this works but there's definitely a trade-off between speed and accuracy Destiny uses model parallel training so instead of splitting the data across multiple gpus it splits the model across multiple gpus so all the layers are spread out across multiple gpus on the same server automatically for you Amazon had to do this because the weight matrices it had for rex that is all the mappings of users and attributes just didn't fit in the memory of a single GPU when it comes to M libraries Destiny isn't as general purpose as tensorflow but it is twice as fast when it comes to dealing with sparse data so we'll follow our methodology and collect our data set build the model train the model and test the model we'll call the retrieve data set method with a parameter as a URL to our downloadable model in our case we're going to use a sample movie lens data set which contains user ratings for a lot of different movies and their Associated tags once we have we want to convert it to a format our ml Library can read in this case it's the net CDF format net CDF is designed for efficient calization of a large array of numbers and it's what Destiny expects we generate for both the input and output layer of our neural network and we'll use the name of the downloaded data set as our parameter both of these functions generate a net cvf file an index file for neurons and an index file for features once we've generated our model it's time to train our neural network in Destiny you build your model in a Json file instead of programmatically we can see in the config.js the structure of the neural network this is where we set our hyper parameters the most important takeaway here is that we are creating a three-layer feedforward neural network that means data just flows one way with one 128 node hidden layer and our activation function at each node is the classic sigmoid which turns values into probabilities we can go ahead and run our train function with the batch size and number of epoch at the parameters we'll set the batch size or number of examples to 256 and the number of epoch or runs to 10 once we run this it'll create a newly trained model file called g. NC which we can then use to predict recommendations our last step is to predict recommendations so we can just call the predict method and set the number of recommendations parameter to 10 this will place the newly created predictions in the Rex file now that we have our code ready to be compiled and run we want to up load it to AWS to start off we'll click on the ec2 button which will take us to Amazon's cloud computing service then we want to make sure we're in the US East North Virginia region since Amazon created a preconfigured image with dependencies like Cuda and open API already set up for us in that region we'll click on Amis under the images directory of the left sidebar and the search for the instance called Ami D6 F2 E6 BC it should pop up and then we'll click the blue launch button to spin up an instance using that image then it'll show us a list of instance types since we want to speed up training time let's go ahead and choose the GPU option here then we'll click review and launch and see the final page before we can launch our instance everything looks good to go so let's click launch it'll prompt you to create a new key pair go ahead and download it so you have it locally this will have authorize your machine to connect to AWS now that we've successfully launched a GPU inance we need to upload our code to it and train it I'm a fan of using filezilla to upload files so let's use that we'll click the site manager icon then paste in the host name we got to be sure to set the protocol to SFTP then set the login type to normal and the user is called Ubuntu once we've set the fields we can click connect and it'll show us all the current files in our instance let's go ahead and drag and drop our project into the root folder now that our code is in our ec2 instance we can can open up terminal and SSH into it we can find the SSH snippet for terminal under the instances section once we click the connect button perfect let's just paste this baby right into terminal boom we're in let's CD into our directory before we run our code we'll need to do two things add the npic and nvcc compilers to our path and make the library we can export npic and then run make then we'll export nvcc now we can run our script and once that's done we'll have Rex and our Rex folder that's pretty much it you can scale your neural net accordingly depending on the size of your data check out the links down below and please subscribe for more machine learning videos I've got to go fix a runtime error so thanks for watching
Original Description
This video will get you up and running with your first movie recommender system in just 10 lines of C++. We train a neural network on a MovieLens dataset of movie ratings by different users to generate a top 10 recommendation list for the default user ID.
The code for this video is here (everything included):
https://github.com/llSourcell/Movie_Recommender
I created a Slack channel for us, sign up here:
https://wizards.herokuapp.com/
The Original Amazon DSSTNE code is here:
https://github.com/amznlabs/amazon-dsstne
Link to AWS:
https://aws.amazon.com/
Link to FileZilla:
https://sourceforge.net/projects/filezilla/
Paper I found pretty cool (a deep learning based rec system):
https://arxiv.org/pdf/1409.2944.pdf
And a correction -- Scott grand recently tested it vs Tensorflow and reported not just a 2x, but a 15x speedup:
https://medium.com/@scottlegrand/first-dsstne-benchmarks-tldr-almost-15x-faster-than-tensorflow-393dbeb80c0f#.loze1hltg
I love you guys! Thanks for watching my videos, I do it for you. I left my awesome job at Twilio and I'm doing this full time now.
I recently created a Patreon page. If you like my videos, feel free to help support my effort here!:
https://www.patreon.com/user?ty=h&u=3191693
Much more to come so please subscribe, like, and comment.
Follow me:
Twitter: https://twitter.com/sirajraval
Facebook: https://www.facebook.com/sirajology Instagram: https://www.instagram.com/sirajraval/ Instagram: https://www.instagram.com/sirajraval/
Signup for my newsletter for exciting updates in the field of AI:
https://goo.gl/FZzJ5w
Hit the Join button above to sign up to become a member of my channel for access to exclusive content! Join my AI community: http://chatgptschool.io/ Sign up for my AI Sports betting Bot, WagerGPT! (500 spots available): https://www.wagergpt.xyz
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Siraj Raval · Siraj Raval · 18 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
▶
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
What is Bitcoin?
Siraj Raval
5 Ways to Use Bitcoin
Siraj Raval
BTC Fever - Siraj [Music Video]
Siraj Raval
5 Reasons to Build Decentralized Apps
Siraj Raval
The Interplanetary File System
Siraj Raval
How to Build a Dapp in 3 min
Siraj Raval
Life Before Smartphones
Siraj Raval
4 Ways to Use Smart Contracts
Siraj Raval
3 Dapps You HAVE to See
Siraj Raval
Char's Life as a BitTorrent Engineer
Siraj Raval
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
Build a Neural Net in 4 Minutes
Siraj Raval
Sentiment Analysis in 4 Minutes
Siraj Raval
The Hackathon Life
Siraj Raval
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
Build a Chatbot - ML for Hackers #6
Siraj Raval
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
Build a Recurrent Neural Net in 5 Min
Siraj Raval
Build a Simulation in 5 Min
Siraj Raval
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
Tensorboard Explained in 5 Min
Siraj Raval
Generate Music in TensorFlow
Siraj Raval
Build a Game Bot (LIVE)
Siraj Raval
Deep Learning Frameworks Compared
Siraj Raval
Introduction - Learn Python for Data Science #1
Siraj Raval
Build a Neural Network (LIVE)
Siraj Raval
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
Pong Neural Network (LIVE)
Siraj Raval
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
Visualizing Data with D3.js (LIVE)
Siraj Raval
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
Enter Siraj [Music Video]
Siraj Raval
Build a Web Scraper (LIVE)
Siraj Raval
Why is P vs NP Important?
Siraj Raval
How to Make a Neural Network (LIVE)
Siraj Raval
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
How to Make an Amazing Video Game Bot Easily
Siraj Raval
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
The Best Way to Prepare a Dataset Easily
Siraj Raval
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval
More on: ML Pipelines
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
10 Python Concepts You Must Know Before Calling Yourself Advanced
Medium · AI
10 Python Concepts You Must Know Before Calling Yourself Advanced
Medium · Data Science
10 Python Concepts You Must Know Before Calling Yourself Advanced
Medium · Programming
10 Python Concepts You Must Know Before Calling Yourself Advanced
Medium · Python
🎓
Tutor Explanation
DeepCamp AI