Optimizers in Neural Networks - EXPLAINED!

CodeEmporium · Advanced ·📐 ML Fundamentals ·2y ago

Key Takeaways

The video explains optimizers in neural networks, including stochastic gradient descent, momentum, NAG method, Adagrad, Adadelta, RMSprop, Adam, and Nadam, and how they are used to update model parameters during training.

Full Transcript

greetings fellow Learners welcome to another video in a playlist of videos on the fundamentals of deep learning and neural networks but before we get started with this wonderful world of optimizers I have a thought-provoking question for you how do you usually learn new things are you a visual learner where you prefer visuals to understand Concepts or are you more of a Hands-On learner where getting your hands dirty would be the best way to learn for you or is there another method that you prefer as a learning mode please comment down below your thoughts on this and let's have a discussion now this video is going to be divided into three passes where in the first pass we're going to start with an overview of optimizers themselves then go into their types and some other details too so let's get to it this here is a simple feed forward neural network now we want this neural network to take in an image and be able to classify it as either a dog or not dog and so the neural network needs to learn specifically these Edge weights or weight parameters need to be learned let's illustrate a specific optimization algorithm called stochastic gradient descent so first we pass an image into the network then the network makes a prediction of whether the image is either a dog or not this network will determine like a probability value that's between 0o and one we compare this to the ground truth which is going to be one since it's a dog we'll pass both of these prediction and the ground truth into a loss function to generate a loss for this classification phase this loss function could be a cross entropy loss now we take this loss and back propagate through the network in order to compute the gradient of the loss with respect to the individual parameters of the network for more details on this back propagation process check out this video on back propagation we use the gradients computed in the optimization algorithm in the case of stochastic gradient descent we update each weight parameter using this formula this here is one iteration of weight updates and we repeat the process hundreds or thousands of times during the entirety of the training process then during the inference phase we will pass an unseen image to the network and ideally it will be able to make the correct prediction of whether it is a dog or not a dog squeeze time have you been paying attention let's quiz you to find out what is the difference between back propagation and an Optimizer a back propagation computes gradients while optimizers compute updated model parameters B back propagation computes updated model parameters and the optimizer computes gradients C back propagation and optimizers are interchangeable terms describing the same process or D back propagation optimizers are unrelated processes in the neural network training comment your answer down below and let's have a discussion and at this point if you do think I deserve it please do give this video a like because it will help me out a lot that'll do it for quiz one and pass one of the explanation but I'll be back so keep paying attention optimizers Define how neural networks learn this here is a non-exhaustive list of optimization algorithms and while it seems that there's so many of them they're all actually kind of related to each other so let's talk talk about each of them a little briefly for example sarcastic gradient descent this is exactly what we described in the previous pass so for every single input label pair we will update label parameters step by step now the concept of momentum helps speed up learning and this is done by making larger learning jumps for common examples and smaller learning jumps for outlier examples now in the nestra accelerated gradient or nag method this is the equivalent of stochastic gradient descent plus momentum plus a concept called acceleration acceleration ensures that the algorithm better anticipates the direction of the gradient for stable training next is adagrad this is an Adaptive learning rate algorithm and this means that the learning rate can be different for different parameters in the out ofr case the learning rate depends on the gradient so in this case the parameters that have large gradients will have a smaller learning rate but parameters with smaller gradients will have a larger learning rate but there's a little bit of a problem with this here the denominator is a sum of squared gradients over time which can increase to an arbitrarily large number and so the overall learning rate will become close to zero to combat this two optimizers were developed independently of each other one of them was adad Delta and the other was RMS prop both have slight modifications to ensure that this denominator does not explode over time and this allows stable convergence now next is adom Adam is another adaptive learning rate algorithm that does RMS prop but also adds some momentum it performs well on many problems and it's one of the most common op optimizers that we see today and then we have natam which is a combination of the nestra accelerated gradient and atom and it offers fast convergence and good General performance so for more information on each of these Optimizer algorithms and how they interplay with each other digging into the math so you understand why things happen the way they do I recommend checking out this video on optimizers quiz time [Music] it's that time of video again have you been paying attention let's quiz you to find out why is Adam used over stochastic gradient descent in practice a Adam is computationally more efficient and has fewer hyperparameters B Adam is less prone to overfitting compared to stochastic gradient descent C adom generally converges faster and requires less less manual tuning or D Adam has a more straightforward optimization landscape comment your answer down below and let's have a discussion now that'll do it for quiz time for now but do keep paying attention because I will be back to quiz you for this pass I wanted to get a fun take on the types of optimizers and so I created a short video that we can watch together hey want to hike Sunday sure where to L Canyon oh the usual yeah it's a fun downward hike to the lowest point I don't know I kind of struggle to find the end well maybe you should take baby steps like me but you take forever y'all do know there is a middle ground right true and we can even run down some parts since their trajectory is obvious but for another perspective it would be better to go off Trail and adapt to your surroundings is that fun more degrees of freedom oh nice so you're the best one here nah he tends to slow down when the hike gets long I'm more adaptive and faster so you're the best one here cute and you are at a Delta but faster are you the best hi there's no end to this no you know what keeps me up at night what knowing that if we all started a hike together we'd end up alone and some of us may never be found never reaching the bottom so Sunday squeeze time okay this is going to be a fun one what are the primary roles of the loss function and Optimizer in the training of neural networks a the loss function computes gradients while the optimizer quantifies the model's performance B the optimizer determines the model's architecture while the loss function guides parameter updates during training C the loss function quantifies the model's performance while the optimized adjusts the model parameters during training or D the loss function is responsible for hyperparameter tuning while the optimizer computes model predictions comment your answer down below and let's have a discussion and once again if you do think I deserve it please do consider giving this video a like and it'll help me out a lot now that's going to do it for the final quiz and pass three of this explanation and before we go though let's generate a summary back propagation is used to compute the gradient of floss with respect to each parameter of the neural network optimizers Define how we use this gradient to actually update the parameters there are many types of optimization algorithms and each algorithm overcomes some shortcoming of a preceding algorithm now that's all we have for today thank you all so much for watching and like I mentioned before if you do like this video please do consider giving it a like if you're interested in getting more information on optimizers in a more relatable way and you're not afraid of some math do check out this video where we get into some details thank you all so much once again and I will see you in the next one bye-bye

Original Description

Let's talk about optimizers in neural networks. ABOUT ME ⭕ Subscribe: https://www.youtube.com/c/CodeEmporium?sub_confirmation=1 📚 Medium Blog: https://medium.com/@dataemporium 💻 Github: https://github.com/ajhalthor 👔 LinkedIn: https://www.linkedin.com/in/ajay-halthor-477974bb/ RESOURCES [1] Code to build first neural network: https://github.com/ajhalthor/deep-learning-101/tree/main [2] More details on Activation functions: https://www.youtube.com/watch?v=s-V7gKrsels PLAYLISTS FROM MY CHANNEL ⭕ Reinforcement Learning 101: https://youtube.com/playlist?list=PLTl9hO2Oobd9kS--NgVz0EPNyEmygV1Ha&si=AuThDZJwG19cgTA8 Natural Language Processing 101: https://youtube.com/playlist?list=PLTl9hO2Oobd_bzXUpzKMKA3liq2kj6LfE&si=LsVy8RDPu8jeO-cc ⭕ Transformers from Scratch: https://youtube.com/playlist?list=PLTl9hO2Oobd_bzXUpzKMKA3liq2kj6LfE ⭕ ChatGPT Playlist: https://youtube.com/playlist?list=PLTl9hO2Oobd9coYT6XsTraTBo4pL1j4HJ ⭕ Convolutional Neural Networks: https://youtube.com/playlist?list=PLTl9hO2Oobd9U0XHz62Lw6EgIMkQpfz74 ⭕ The Math You Should Know : https://youtube.com/playlist?list=PLTl9hO2Oobd-_5sGLnbgE8Poer1Xjzz4h ⭕ Probability Theory for Machine Learning: https://youtube.com/playlist?list=PLTl9hO2Oobd9bPcq0fj91Jgk_-h1H_W3V ⭕ Coding Machine Learning: https://youtube.com/playlist?list=PLTl9hO2Oobd82vcsOnvCNzxrZOlrz3RiD MATH COURSES (7 day free trial) 📕 Mathematics for Machine Learning: https://imp.i384100.net/MathML 📕 Calculus: https://imp.i384100.net/Calculus 📕 Statistics for Data Science: https://imp.i384100.net/AdvancedStatistics 📕 Bayesian Statistics: https://imp.i384100.net/BayesianStatistics 📕 Linear Algebra: https://imp.i384100.net/LinearAlgebra 📕 Probability: https://imp.i384100.net/Probability OTHER RELATED COURSES (7 day free trial) 📕 ⭐ Deep Learning Specialization: https://imp.i384100.net/Deep-Learning 📕 Python for Everybody: https://imp.i384100.net/python 📕 MLOps Course: https://imp.i384100.net/MLOps 📕 Natural Language Processing (NLP): http
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from CodeEmporium · CodeEmporium · 0 of 60

← Previous Next →
1 Linear Regression and Multiple Regression
Linear Regression and Multiple Regression
CodeEmporium
2 Logistic Regression - THE MATH YOU SHOULD KNOW!
Logistic Regression - THE MATH YOU SHOULD KNOW!
CodeEmporium
3 Generative Adversarial Networks - FUTURISTIC & FUN AI !
Generative Adversarial Networks - FUTURISTIC & FUN AI !
CodeEmporium
4 Deep Learning on the Cloud - GPU TO LEARN FASTER
Deep Learning on the Cloud - GPU TO LEARN FASTER
CodeEmporium
5 Deep Mind's AlphaGo Zero - EXPLAINED
Deep Mind's AlphaGo Zero - EXPLAINED
CodeEmporium
6 Mask Region based Convolution Neural Networks - EXPLAINED!
Mask Region based Convolution Neural Networks - EXPLAINED!
CodeEmporium
7 Attention in Neural Networks
Attention in Neural Networks
CodeEmporium
8 Depthwise Separable Convolution - A FASTER CONVOLUTION!
Depthwise Separable Convolution - A FASTER CONVOLUTION!
CodeEmporium
9 One Neural network learns EVERYTHING ?!
One Neural network learns EVERYTHING ?!
CodeEmporium
10 Neural Voice Cloning
Neural Voice Cloning
CodeEmporium
11 AI creates Image Classifiers…by DRAWING?
AI creates Image Classifiers…by DRAWING?
CodeEmporium
12 Unpaired Image-Image Translation using CycleGANs
Unpaired Image-Image Translation using CycleGANs
CodeEmporium
13 K-Means Clustering - EXPLAINED!
K-Means Clustering - EXPLAINED!
CodeEmporium
14 Random Forest Classification
Random Forest Classification
CodeEmporium
15 Data Science in Finance
Data Science in Finance
CodeEmporium
16 Hypothesis testing with Applications in Data Science
Hypothesis testing with Applications in Data Science
CodeEmporium
17 A/B Testing - Simply Explained
A/B Testing - Simply Explained
CodeEmporium
18 The Kernel Trick - THE MATH YOU SHOULD KNOW!
The Kernel Trick - THE MATH YOU SHOULD KNOW!
CodeEmporium
19 Support Vector Machines - THE MATH YOU  SHOULD KNOW
Support Vector Machines - THE MATH YOU SHOULD KNOW
CodeEmporium
20 Principal Component Analysis (PCA) - THE MATH YOU SHOULD KNOW!
Principal Component Analysis (PCA) - THE MATH YOU SHOULD KNOW!
CodeEmporium
21 History of Calculus - Animated
History of Calculus - Animated
CodeEmporium
22 Curiosity in AI
Curiosity in AI
CodeEmporium
23 DropBlock - A BETTER DROPOUT for Neural Networks
DropBlock - A BETTER DROPOUT for Neural Networks
CodeEmporium
24 Autoencoders - EXPLAINED
Autoencoders - EXPLAINED
CodeEmporium
25 Recurrent Neural Networks - EXPLAINED!
Recurrent Neural Networks - EXPLAINED!
CodeEmporium
26 LSTM Networks - EXPLAINED!
LSTM Networks - EXPLAINED!
CodeEmporium
27 Building an Image Captioner with Neural Networks
Building an Image Captioner with Neural Networks
CodeEmporium
28 10 Machine Learning Questions - ANSWERED!
10 Machine Learning Questions - ANSWERED!
CodeEmporium
29 How do neural networks work?
How do neural networks work?
CodeEmporium
30 Evolution of Face Generation |  Evolution of GANs
Evolution of Face Generation | Evolution of GANs
CodeEmporium
31 How does Google Translate's AI work?
How does Google Translate's AI work?
CodeEmporium
32 How to keep up with AI research?
How to keep up with AI research?
CodeEmporium
33 How does YouTube recommend videos? - AI EXPLAINED!
How does YouTube recommend videos? - AI EXPLAINED!
CodeEmporium
34 Variational Autoencoders - EXPLAINED!
Variational Autoencoders - EXPLAINED!
CodeEmporium
35 Logistic Regression - VISUALIZED!
Logistic Regression - VISUALIZED!
CodeEmporium
36 Gradient Descent - THE MATH YOU SHOULD KNOW
Gradient Descent - THE MATH YOU SHOULD KNOW
CodeEmporium
37 Boosting - EXPLAINED!
Boosting - EXPLAINED!
CodeEmporium
38 Transformer Neural Networks - EXPLAINED! (Attention is all you need)
Transformer Neural Networks - EXPLAINED! (Attention is all you need)
CodeEmporium
39 Loss Functions - EXPLAINED!
Loss Functions - EXPLAINED!
CodeEmporium
40 Optimizers - EXPLAINED!
Optimizers - EXPLAINED!
CodeEmporium
41 NLP with Neural Networks & Transformers
NLP with Neural Networks & Transformers
CodeEmporium
42 Batch Normalization - EXPLAINED!
Batch Normalization - EXPLAINED!
CodeEmporium
43 Activation Functions - EXPLAINED!
Activation Functions - EXPLAINED!
CodeEmporium
44 Data Scientist Answers Interview Questions
Data Scientist Answers Interview Questions
CodeEmporium
45 Why use GPU with Neural Networks?
Why use GPU with Neural Networks?
CodeEmporium
46 How do GPUs speed up Neural Network training?
How do GPUs speed up Neural Network training?
CodeEmporium
47 BERT Neural Network - EXPLAINED!
BERT Neural Network - EXPLAINED!
CodeEmporium
48 ConvNets Scaled Efficiently
ConvNets Scaled Efficiently
CodeEmporium
49 Transformer Neural Net makes music! (JukeboxAI)
Transformer Neural Net makes music! (JukeboxAI)
CodeEmporium
50 What do filters of Convolution Neural Network learn?
What do filters of Convolution Neural Network learn?
CodeEmporium
51 We're hosting a Machine Learning Conference!
We're hosting a Machine Learning Conference!
CodeEmporium
52 MLconfEU 2020: Machine Learning Conference for Software Engineers
MLconfEU 2020: Machine Learning Conference for Software Engineers
CodeEmporium
53 Are Neural Networks Intelligent?
Are Neural Networks Intelligent?
CodeEmporium
54 Time Series Forecasting with Machine Learning
Time Series Forecasting with Machine Learning
CodeEmporium
55 Few Shot Learning - EXPLAINED!
Few Shot Learning - EXPLAINED!
CodeEmporium
56 How does a Data Scientist Fight FRAUD?
How does a Data Scientist Fight FRAUD?
CodeEmporium
57 How would a Data Scientist analyze Customer Churn?
How would a Data Scientist analyze Customer Churn?
CodeEmporium
58 Expectations with Machine Learning
Expectations with Machine Learning
CodeEmporium
59 Why Logistic Regression DOESN'T return probabilities?!
Why Logistic Regression DOESN'T return probabilities?!
CodeEmporium
60 How you SHOULD code Machine Learning
How you SHOULD code Machine Learning
CodeEmporium

This video explains the role of optimizers in neural networks and how they are used to update model parameters during training. It covers various optimization algorithms, including stochastic gradient descent, momentum, and adaptive learning rates. By watching this video, you will learn how to implement these algorithms in your own machine learning projects.

Key Takeaways
  1. Pass an image into the network
  2. Make a prediction of whether the image is a dog or not
  3. Compare the prediction to the ground truth
  4. Pass both the prediction and the ground truth into a loss function to generate a loss
  5. Back propagate through the network to compute the gradient of the loss with respect to the individual parameters of the network
  6. Use an optimizer to update the model parameters based on the gradient
💡 The choice of optimizer can significantly impact the performance of a neural network, and understanding how different optimizers work is crucial for building effective machine learning models.

Related Reads

📰
Model Assumptions & Diagnostics — Deep Dive + Problem: Alpha Matte Compositing
Learn to identify and diagnose model assumptions in linear regression to improve your machine learning models
Dev.to AI
📰
Differentiation: Gradients, Jacobians & Hessians Derivatives, partial derivatives, gradient…
Learn about differentiation in machine learning, including gradients, Jacobians, and Hessians, to improve model training
Medium · AI
📰
Differentiation: Gradients, Jacobians & Hessians Derivatives, partial derivatives, gradient…
Learn about differentiation in machine learning, including gradients, Jacobians, and Hessians, to improve model training
Medium · Machine Learning
📰
Differentiation: Gradients, Jacobians & Hessians Derivatives, partial derivatives, gradient…
Learn about differentiation in data science, including gradients, Jacobians, and Hessians, to improve model training
Medium · Data Science
Up next
Solve a Murder Mystery with Me Using Bayes’ Theorem 🕵️‍♀️ | Bayesian Reasoning Explained
Pavithra’s Podcast
Watch →