Exponentially Weighted Averages (C2W2L03)

DeepLearningAI · Beginner ·📐 ML Fundamentals ·8y ago

Key Takeaways

Explains exponentially weighted averages in deep learning

Full Transcript

I want to show you a few optimization algorithms that are faster than gradient descent in order to understand those algorithms you need to be able to use something called exponentially weighted averages also called exponentially weighted moving averages in statistics let's first talk about that and it will use this to build out two most sophisticated optimization algorithms so even though I now live in the United States I was born in London so for this example I got the daily temperature from London from last year so on January 1st temperature was 40 degrees Fahrenheit and I know most the world uses a Celsius system but I guess Olivia United States which uses Fahrenheit so that's four degrees Celsius and on January second it was 90 degrees Celsius and so on and then about halfway through the year a year has 365 days so this would be sometimes day number 118 would be sometime in late May I guess 160 degrees Fahrenheit which is 15 degrees Celsius and so on so start to get near warmer to one summer and it was colder in January so you plot the data you end up with this with day one being sometime in January that you know being the beginning of summer and that's the end of the year kind of late December so this would be January of January first as you middle the Year approaching summer and this would be the data from the end of the year so this need to look a little bit noisy and if you want to compute the trends kind of the local average or a moving average of the temperature here's what you can do let's initialize V zero equals zero and then on every day we're going to average it with a weight of 0.9 times whatever is the previous value plus 0.1 times the that day's temperature so theta one here would be the temperature from this first day and on a second day we're again going to take a weighted average so 0.9 times of the previous value plus 0.1 times today's temperature so on v2 plus 0.1 times theta 3 and so on and the more general formula is V on a given day is 0.9 times V from the previous day plus 0.1 times the temperature of that day so if you compute this and plot it in red this is what you get you get a moving average or what's called an exponentially weighted average of the daily temperature so let's look at the equation we had from the previous slide it was VT equals previously we had 0.9 do not turn that into parameter beta beta times BT minus 1 plus and appreci with 0.1 then turn that into 1 minus beta times theta T so previously we had beta equals 0.9 it turns out that for reasons we'll go into later when you compute this you can think of VT as approximately averaging over something like 1 over 1 minus beta days temperature so for example when beta equals 0.9 you could think of this as averaging over the last 10 days temperature and that was the red line now let's try something else let's say it beta to be very close to 1 this is 0.98 then if you look at 1 over 1 minus 0.98 this is equal to 50 so this is zeal think of this is averaging over roughly the last 50 days temperature and if you plot that you get this green line so notice a couple things with this very high value of beta the plot you get is much smoother because you're now averaging over more days of temperature so the curve is just you know less Wiggly is now smoother but on the flip side the curve is now shifted further to the right because you're now averaging over a much larger window of temperature and by averaging over a larger window this formula is exponentially weighted average formula it adapts more slowly when the temperature changes right so there's just a little more latency and the reason for that is when beta 0 0.98 then it's giving a lot of weight to the previous value and a much smaller weight just point 0 to 2 whatever you're seeing right now so when the temperature changes or in term she goes up or down this exponentially weighted average just a decimal slowly when beta is so large now let's try another value that you set data to another extreme let's say it is 0.5 then this by the formula we have on the right this is something like averaging over just two days temperature and you plot that to get this yellow line and by averaging only over two days temperature you have a muchness as if you're averaging over much shorter window so you're much more noisy much more susceptible to outliers but this adapts much more quickly to the temperature changes so this formula is how you implement an exponentially weighted average again is called an exponentially weighted moving average industry 2/6 literature and I'm going to call it exponentially weighted average for short and by varying this parameter or later we'll see essentially hyper parameter of your learning algorithm you can get slightly different effects and it will usually be some value in between their workspace that gives you the red curve which you're maybe looks like a better average in temperature than either the green or the yellow curve you now know the basics of how to compute exponentially weighted averages in the next video let's gain a bit more intuition about what is doing

Original Description

Take the Deep Learning Specialization: http://bit.ly/38iUGz1 Check out all our courses: https://www.deeplearning.ai Subscribe to The Batch, our weekly newsletter: https://www.deeplearning.ai/thebatch Follow us: Twitter: https://twitter.com/deeplearningai_ Facebook: https://www.facebook.com/deeplearningHQ/ Linkedin: https://www.linkedin.com/company/deeplearningai
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from DeepLearningAI · DeepLearningAI · 15 of 60

1 Forward and Backward Propagation (C1W4L06)
Forward and Backward Propagation (C1W4L06)
DeepLearningAI
2 deeplearning.ai's Heroes of Deep Learning: Yuanqing Lin
deeplearning.ai's Heroes of Deep Learning: Yuanqing Lin
DeepLearningAI
3 deeplearning.ai's Heroes of Deep Learning: Ruslan Salakhutdinov
deeplearning.ai's Heroes of Deep Learning: Ruslan Salakhutdinov
DeepLearningAI
4 deeplearning.ai's Heroes of Deep Learning: Yoshua Bengio
deeplearning.ai's Heroes of Deep Learning: Yoshua Bengio
DeepLearningAI
5 deeplearning.ai's Heroes of Deep Learning: Pieter Abbeel
deeplearning.ai's Heroes of Deep Learning: Pieter Abbeel
DeepLearningAI
6 deeplearning.ai's Heroes of Deep Learning: Ian Goodfellow
deeplearning.ai's Heroes of Deep Learning: Ian Goodfellow
DeepLearningAI
7 deeplearning.ai's Heroes of Deep Learning: Andrej Karpathy
deeplearning.ai's Heroes of Deep Learning: Andrej Karpathy
DeepLearningAI
8 Using an Appropriate Scale (C2W3L02)
Using an Appropriate Scale (C2W3L02)
DeepLearningAI
9 Gradient Checking (C2W1L13)
Gradient Checking (C2W1L13)
DeepLearningAI
10 Gradient Checking Implementation Notes (C2W1L14)
Gradient Checking Implementation Notes (C2W1L14)
DeepLearningAI
11 Learning Rate Decay (C2W2L09)
Learning Rate Decay (C2W2L09)
DeepLearningAI
12 Understanding Mini-Batch Gradient Dexcent (C2W2L02)
Understanding Mini-Batch Gradient Dexcent (C2W2L02)
DeepLearningAI
13 Mini Batch Gradient Descent (C2W2L01)
Mini Batch Gradient Descent (C2W2L01)
DeepLearningAI
14 The Problem of Local Optima (C2W3L10)
The Problem of Local Optima (C2W3L10)
DeepLearningAI
Exponentially Weighted Averages (C2W2L03)
Exponentially Weighted Averages (C2W2L03)
DeepLearningAI
16 Tuning Process (C2W3L01)
Tuning Process (C2W3L01)
DeepLearningAI
17 Understanding Exponentially Weighted Averages (C2W2L04)
Understanding Exponentially Weighted Averages (C2W2L04)
DeepLearningAI
18 Bias Correction of Exponentially Weighted Averages (C2W2L05)
Bias Correction of Exponentially Weighted Averages (C2W2L05)
DeepLearningAI
19 Gradient Descent With Momentum (C2W2L06)
Gradient Descent With Momentum (C2W2L06)
DeepLearningAI
20 Normalizing Activations in a Network (C2W3L04)
Normalizing Activations in a Network (C2W3L04)
DeepLearningAI
21 Hyperparameter Tuning in Practice (C2W3L03)
Hyperparameter Tuning in Practice (C2W3L03)
DeepLearningAI
22 Adam Optimization Algorithm (C2W2L08)
Adam Optimization Algorithm (C2W2L08)
DeepLearningAI
23 RMSProp (C2W2L07)
RMSProp (C2W2L07)
DeepLearningAI
24 Fitting Batch Norm Into Neural Networks (C2W3L05)
Fitting Batch Norm Into Neural Networks (C2W3L05)
DeepLearningAI
25 Why Does Batch Norm Work? (C2W3L06)
Why Does Batch Norm Work? (C2W3L06)
DeepLearningAI
26 Batch Norm At Test Time (C2W3L07)
Batch Norm At Test Time (C2W3L07)
DeepLearningAI
27 Softmax Regression (C2W3L08)
Softmax Regression (C2W3L08)
DeepLearningAI
28 Deep Learning Frameworks (C2W3L10)
Deep Learning Frameworks (C2W3L10)
DeepLearningAI
29 Neural Network Overview (C1W3L01)
Neural Network Overview (C1W3L01)
DeepLearningAI
30 Training Softmax Classifier (C2W3L09)
Training Softmax Classifier (C2W3L09)
DeepLearningAI
31 Why Deep Representations? (C1W4L04)
Why Deep Representations? (C1W4L04)
DeepLearningAI
32 Gradient Descent For Neural Networks (C1W3L09)
Gradient Descent For Neural Networks (C1W3L09)
DeepLearningAI
33 Neural Network Representations (C1W3L02)
Neural Network Representations (C1W3L02)
DeepLearningAI
34 TensorFlow (C2W3L11)
TensorFlow (C2W3L11)
DeepLearningAI
35 Activation Functions (C1W3L06)
Activation Functions (C1W3L06)
DeepLearningAI
36 Explanation For Vectorized Implementation (C1W3L05)
Explanation For Vectorized Implementation (C1W3L05)
DeepLearningAI
37 Getting Matrix Dimensions Right (C1W4L03)
Getting Matrix Dimensions Right (C1W4L03)
DeepLearningAI
38 Understanding Dropout (C2W1L07)
Understanding Dropout (C2W1L07)
DeepLearningAI
39 Building Blocks of a Deep Neural Network (C1W4L05)
Building Blocks of a Deep Neural Network (C1W4L05)
DeepLearningAI
40 Why Non-linear Activation Functions (C1W3L07)
Why Non-linear Activation Functions (C1W3L07)
DeepLearningAI
41 Computing Neural Network Output (C1W3L03)
Computing Neural Network Output (C1W3L03)
DeepLearningAI
42 Backpropagation Intuition (C1W3L10)
Backpropagation Intuition (C1W3L10)
DeepLearningAI
43 Train/Dev/Test Sets (C2W1L01)
Train/Dev/Test Sets (C2W1L01)
DeepLearningAI
44 Deep L-Layer Neural Network (C1W4L01)
Deep L-Layer Neural Network (C1W4L01)
DeepLearningAI
45 Random Initialization (C1W3L11)
Random Initialization (C1W3L11)
DeepLearningAI
46 Other Regularization Methods (C2W1L08)
Other Regularization Methods (C2W1L08)
DeepLearningAI
47 Normalizing Inputs (C2W1L09)
Normalizing Inputs (C2W1L09)
DeepLearningAI
48 Derivatives Of Activation Functions (C1W3L08)
Derivatives Of Activation Functions (C1W3L08)
DeepLearningAI
49 Parameters vs Hyperparameters (C1W4L07)
Parameters vs Hyperparameters (C1W4L07)
DeepLearningAI
50 Vectorizing Across Multiple Examples (C1W3L04)
Vectorizing Across Multiple Examples (C1W3L04)
DeepLearningAI
51 What does this have to do with the brain? (C1W4L08)
What does this have to do with the brain? (C1W4L08)
DeepLearningAI
52 Dropout Regularization (C2W1L06)
Dropout Regularization (C2W1L06)
DeepLearningAI
53 Vanishing/Exploding Gradients (C2W1L10)
Vanishing/Exploding Gradients (C2W1L10)
DeepLearningAI
54 Basic Recipe for Machine Learning (C2W1L03)
Basic Recipe for Machine Learning (C2W1L03)
DeepLearningAI
55 Bias/Variance (C2W1L02)
Bias/Variance (C2W1L02)
DeepLearningAI
56 Forward Propagation in a Deep Network (C1W4L02)
Forward Propagation in a Deep Network (C1W4L02)
DeepLearningAI
57 Weight Initialization in a Deep Network (C2W1L11)
Weight Initialization in a Deep Network (C2W1L11)
DeepLearningAI
58 Numerical Approximations of Gradients (C2W1L12)
Numerical Approximations of Gradients (C2W1L12)
DeepLearningAI
59 Regularization (C2W1L04)
Regularization (C2W1L04)
DeepLearningAI
60 Why Regularization Reduces Overfitting (C2W1L05)
Why Regularization Reduces Overfitting (C2W1L05)
DeepLearningAI

Related Reads

📰
Matrix Decompositions — Deep Dive + Problem: Scaled Dot-Product Attention
Learn about matrix decompositions and their role in linear algebra, and apply this knowledge to solve the Scaled Dot-Product Attention problem
Dev.to AI
📰
Research First. Prompt Later—Day 30
Learn to prioritize research over prompting in machine learning to improve model performance and efficiency
Medium · Machine Learning
📰
How TypeScript Makes Your JavaScript Run Faster
Learn how TypeScript can indirectly improve JavaScript runtime performance
Dev.to · Doogal Simpson
📰
Recursion Visualization: I Built the Tool I Wish I Had for Learning Recursion
Learn to visualize recursion with a tool built to simplify the learning process, making it easier to understand and solve recursive problems
Medium · Python
Up next
How to Train AI to Play Games ? How AI Learns to Play ? Several Methods EXPLAINED
MaxonShire
Watch →