One-Shot Learning - Fresh Machine Learning #1
Skills:
LLM Foundations70%
Key Takeaways
The video demonstrates One-Shot Learning using a handwritten character classifier in Python with SciPy, exploring the concept of learning with few examples and its potential to democratize machine learning.
Full Transcript
you only get one shot do not miss your chance to blow opportunity it actually takes more than one shot to train a [Music] model hello world it's SJ and welcome to fresh machine learning this course is all about making bleeding edge machine learning accessible to developers the field is moving faster than Steve Balmer at a developer conference developers developers developers we're going to learn to apply some of the latest machine learning techniques to practical examples that you can integrate into your own apps neural networks have been around since the ' 50s but we've just never had as much data and computing power as we do now we call it deep learning these days and it deserves the Press it's gotten but so many articles claim it replicates the human brain some even make it sound like if we give a deep neural net enough data and compute it'll suddenly become self-aware M the brain is indeed a neural network but do we really learn the way a deep neural net does well let's think about it in order for a deep neural net to learn to say recognize an image of a banana you first have to feed it hundreds of thousands of banana images but think about the way you and I learn if I were to show you an image of a banana for the first time you'd probably be able to recognize a novel banana instantly even if it was a different shape or color we humans don't seem to need thousands of examples just to generalize just a few and we learn richer representations than machines do as well we can use the concepts we learn in other ways like creating new examples if we could create an algorithm to do this to learn concepts with few examples wouldn't that be incredible it would further democratize the field so that not just the big companies like Google and Amazon with huge private internal data sets are able to train their models but anyone can so is there an algorithm that does this well there was a recent paper that came out called human level concept learning through probabilistic program induction the author said let's build a model capable of what's called oneshot learning onshot learning is a type of ml that learns an object category after just one or a few examples oh they use something called basian program learning or BPL to do this basian refers to B theorem which attempts to use Simple stochastic programs to represent Concepts the word stochastic referring to the theory of probability is what base theorem Loosely revolves around so by using simple stochastic programs or probability algorithms BPL can represent Concepts BPL builds these simple stochastic programs compositionally from parts subp parts and spatial relations all these things exist in a hierarchy of knowledge which the machine has gained through little experience so they trained it on a data set of handwriting characters and it was able to recognize characters with the better error rate than deep learning or even humans so does that mean that BPL is a way to go well it does have its flaws it lacks explicit knowledge of certain things like parallel lines Symmetry and connections between ends of strokes and other strokes and the learning isn't really transferable to other things so it's not better than deep learning in every way a few months later though Deep Mind challenged the paper by releasing their own called oneshot learning with memory augmented neural networks the basic idea they had was that deep learning is very data intensive but perhaps there's a way to build a deep neural net that only needs a few examples to learn deep learning without the huge data sets so they built what's called a memory augmented neural network a man has two parts a controller which is either a feed forward neural net or lstm neural net and an external memory module the controller interacts with the external memory module with a number of read write heads it's capable of long-term storage via slow updates of the weights and short-term storage via the external memory module they FedEd a few examples of handwritten characters and continuously trained it thousands of times on just those examples and guess what it outperforms humans as well so they prove that one shot learning can be accomplished by using a neural network architecture which is pretty dope so there are lots of methodologies to implement oneshot learning and in this episode we're going to implement our own we're going to build a onot handwritten character classifier in Python using the scipi library so hold on to your butt we got to import our dependencies first we're going to want three libraries numpy scipi and copy once we have those we can Define two variables the number of runs we want to complete and a reference bar for where we store our class label then in our main method we we can create an array of the size of runs which is 20 we'll use this array to store all of our classification error rates one every run then we'll write a for Loop to train our algorithm 20 times for each run we'll run a classification function which will attempt to classify a small sample set of images and store the error rate in the array then we'll print out the error rate to terminal and when we are done with all of our runs we'll go ahead and get the mean error rate from the array and print it out as the last statement in terminal so how does this classification step work before we answer that we need to understand these two methods load images points and modified house DP distance the load images points function loads an image file in our casee this will be a character image it then converts the image to an array and finds all the non-zero values that is all of the in pixels and stores that in an array then it creates an array of all the coordinates of those pixels and returns that the modified house DF distance is a metric that computes the similarity between two images by comparing their pixel coordinate arrays that comes from the load imagees points function it calculates the mean difference between both images and returns it the last parameter of the classification function cost just notifies a function that small values from the modified house dwarf distance mean more similar lastly let's take a at the classification function itself in this function we retrieve both our training and testing images and load their image Point matrices into memory then we compute the cost Matrix using the modified house DF distance after that we compute the error rate and return it that's all we do this for every run and then average them all and get the average error rate which isn't state-of-the-art like deep mind or BPL but it does make for a good Baseline demo of one shot learning one shot learning will only get more popular over time bunch of cool links down below check them out and please subscribe for more ml videos for now I've got to go fix an index out of bounds eror so thanks for watching
Original Description
Welcome to Fresh Machine Learning! This is my new course dedicated to making bleeding edge machine learning accessible to developers everywhere.
The demo code for this video is a handwritten character classifier in Python using a One-Shot Learning technique with SciPy:
https://github.com/llSourcell/One-Shot-Learning-Demo
I created a Slack channel for us, sign up here:
https://wizards.herokuapp.com/
I introduce two papers in this video
Human Level Concept Learning through Probabilistic Program Induction:
http://web.mit.edu/cocosci/Papers/Science-2015-Lake-1332-8.pdf
and it's associated code is in MatLab:
https://github.com/brendenlake/BPL
but Matlab requires $ to download and Python is better suited for building production apps. I found a great alternative though, these guys are really close to finishing this python library. It's called 'PyBPL' they are working on making the results from the paper generalized so that you can apply BPL to any kind of example dataset. I talked with the lead dev and he said they'd have working demos out in 3-6 weeks so follow this repo!!:
https://github.com/MaxwellRebo/PyBPL
One-Shot Learning with Memory Augmented Neural Networks:
https://arxiv.org/pdf/1605.06065v1.pdf
and it's associated code is here:
https://github.com/tristandeleu/ntm-one-shot
Also, here's another very recent One Shot Learning Paper from DeepMind that I couldn't squeeze into this video but is very interesting:
https://arxiv.org/pdf/1606.04080v1.pdf
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.ins
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Siraj Raval · Siraj Raval · 24 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
▶
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: LLM Foundations
View skill →Related Reads
📰
📰
📰
📰
The Mental Model of PyTorch: Build a Neural Network in 5 Phases
Medium · Deep Learning
Automatic Relevance Determination Regression for Time Series Forecasting
Medium · Data Science
Deploying Multi-Turn RL Infrastructure for Amazon Nova on Amazon SageMaker HyperPod
AWS Machine Learning
Python for Data Science — Sampling and Why Your Conclusions Can Be Wrong
Medium · Machine Learning
🎓
Tutor Explanation
DeepCamp AI