Stanford CS229: Machine Learning - Linear Regression and Gradient Descent | Lecture 2 (Autumn 2018)
2024 ж. 17 Мам.
1 163 196 Рет қаралды
For more information about Stanford’s Artificial Intelligence professional and graduate programs, visit: stanford.io/3pqkTry
This lecture covers supervised learning and linear regression.
Andrew Ng
Adjunct Professor of Computer Science
www.andrewng.org/
To follow along with the course schedule and syllabus, visit:
cs229.stanford.edu/syllabus-au...
#andrewng #machinelearning
Chapters:
00:00 Intro
00:45 Motivate Linear Regression
03:01 Supervised Learning
04:44 Designing a Learning Algorithm
08:27 Parameters of the learning algorithm
14:44 Linear Regression Algorithm
18:06 Gradient Descent
33:01 Gradient Descent Algorithm
42:34 Batch Gradient Descent
44:56 Stochastic Gradient Descent
Dude is a multi-millionaire and took valuable time meticulously teaching students and us. Legend.
Bro needs to train his future employees
yes bro. i think the more people with the knowledge, the faster the breakthroughs in the field
...and FOR FREE.
This course saves my life! The lecturer of the ML course I'm attending rn is just going thru those crazy math derivations preassuming that all the students have mastered it all before😂
0:41: 📚 This class will cover linear regression, batch and stochastic gradient descent, and the normal equations as algorithms for fitting linear regression models. 5:35: 🏠 The speaker discusses using multiple input features, such as size and number of bedrooms, to estimate the size of a house. 12:03: 📝 The hypothesis is defined as the sum of features multiplied by parameters. 18:40: 📉 Gradient descent is a method to minimize a function J of Theta by iteratively updating the values of Theta. 24:21: 📝 Gradient descent is a method used to update values in each step by calculating the partial derivative of the cost function. 30:13: 📝 The partial derivative of a term with respect to Theta J is equal to XJ, and one step of gradient descent updates Theta J 36:08: 🔑 The choice of learning rate in the algorithm affects its convergence to the global minimum. 41:45: 📊 Batch gradient descent is a method in machine learning where the entire training set is processed as one batch, but it has a disadvantage when dealing with large datasets. 47:13: 📈 Stochastic gradient descent allows for faster progress in large datasets but never fully converges. 52:23: 📝 Gradient descent is an iterative algorithm used to find the global optimum, but for linear regression, the normal equation can be used to directly jump to the global optimum. 58:59: 📝 The derivative of a matrix function with respect to the matrix itself is a matrix with the same dimensions, where each element is the derivative with respect to the corresponding element in the original matrix. 1:05:51: 📝 The speaker discusses properties of matrix traces and their derivatives. 1:13:17: 📝 The derivative of the function is equal to one-half times the derivative of Theta multiplied by the transpose of X minus the transpose of y. Recap by Tammy AI
How much we have to pay for your valuable overview on the entire class? Kudos to your efforts 👍
Thank you so much 👍🫡
when u paying 12k to your own university a year just so you can look up a course from a better school for free
University cost needs to be as low cost as possible.
while youtube have the unlimited free information and courses better than the tech university and colleges 🙂
Hahahahaahaha fucking hell thats what i am doing right fucking now.
which uni is that...
@@preyumkumar7404 University of Toronto
Feels like sitting in stanford classroom from india ...Thanks stanford. you guys are best
for real bro, me sitting in panjab, would have never come across how the top uni profs are, this is surreal.
@@gurjotsingh3726 Sat sri akaal, ਖੁਸ਼ਕਿਸਮਤੀ
We learn, and teachers give us the information in a way that can help stimulate our learning abilities. So, we always appreciate our teachers and the facilities contributing to our development. Thank you.
I am not good at math anymore, but I think math is simple if you get the right teachers like you. Tnks.
Thank you to Stanford and Andrew for a wonderful series of lectures!
8:50 notations and symbols 13:08 how to choose theta 17:50 Gradient descent
52:50 Normal equations
Andrew Ng you are the best
Hey can I point out how an amazing teacher professor Andrew is?! Also, I love how he is all excited about the lesson he is giving! It just makes me feel even more interested in the subject. Thanks for this awesome course!
Look at Coursera, he founded that and has many free courses.
One of the greats, a legend in AI & Machine Learning. Up there with Prof. Strang and Prof LeCun.
the best professor in the world.
Thank you so much Dr. Andrew! It took me some time but your stepwise explanation and notes have given me a proper understanding. I'm learning this to make a presentation for my university club. We all are very grateful!
Hi I was not able to download the notes, 404 error, from the course page in description. Other PDFs are available on the course page. Are you enrolled or where did you download the notes from?
@@Amit_Kumar_Trivedi cs229.stanford.edu/lectures-spring2022/main_notes.pdf
@@anushka.narsima thanks
8:50 notations and symbols 13:08 how to choose theta 17:50 Gradient descent 8:42 - 14:42 - Terminologies completion 51:00 - batch 55:00 problem 1 set 57:00 for p 0
notes are not available on the website ???
We define a cost function based on sum of squared errors. The job is minimise this cost function with respect to the parameters. First, we look at (Batch) gradient descent. Second, we look at Stochastic gradient descent, which does not give us the exact value at which the minima is achieved, however, it is much much more effective in dealing with big data. Third, we look at the normal equation. This equation directly gives us the value at which minima is achieved! Linear regression models is one of the few models in which such an equation exist.
I wish you sat next to me in class 😂
Bro who named that equation as normal equation?
@@rajvaghasia9942 the name "normal equation" is because generalizes the concept of perpendiculum (normal to something means perpendicula to something). In fact "the normal equation" represent the projection between the straight line that i draw as a starting point (in the case of LINEAR regression) and the effective sampling data .This projection has , obviously , information about the distances between the real data (sampling data) and my "starting line"...hence to find the optimal curve that fit my data i 've to find weight a bias (in this video Theta0 , Theta1 and so on) to minimize this distance. you can minimize this distance using gradient descend (too much the cost), stochastic gradient descend (doing a set of partial derivative not computing all the gradient of loss function) or using the "normal equations"...uderstand?... Here an image from wikipedia to understand better (the green line are the famous distances) en.wikipedia.org/wiki/File:Linear_least_squares_example2.svg
@@rajvaghasia9942 because we're in the matrix now bro! ha. For real though. It's about the projection matrix and the matrix representation/method of acquiring the beta coefficients.
I have been wondering why we need such an algorithm when we could just derive the least squares estimators. Have you seen any research comparing the gradient descent method of selection of parameters with the typical method of deriving the least squares estimators of the coefficient parameters?
Really easy to understand. Thanks a lot for sharing!
sure it is, it is high school topic, at least in Italy
@@massimovarano407 I'm pretty sure multivariate calculus is not a high-school topic in Europe
8:42 - 14:42 - Terminologies completion 17:51 -- Checkpoint 57:00 - run1
Fantastic. Thank you deeply for sharing
Thank you Stanford for this amazing resource. Pls csn i get a link to the lecture notes. Thanks
Loving the lectures!!
I love you Sir Andrew, you inspire me a lot haha
I really don't have a clue about this stuff, but it's interesting and I can concentrate a lot better when I listen to this lecture so I like it
You can see his lecture on coursera about Machine learning. You will surely get what he is saying in this video.
@@FA-BCS-MUHAMMADHAMIDSAEEDUnkno yes, that course is beginner-friendly. Everyone with basic high school math can take that course even without knowledge of calculus.
Simple and understandable
Very clear explanations. Extra points for sounding like Stewie Griffin
this men is great teatcher
I need that lecture notes ASAP professor
May I ask, down to 7:50 what does O (teta) represent?
39:38 we're subtracting because to minimize the cost function, the two vectors must be at 180⁰. So we get a negative from there.
Knowledge is power
thanks a lot 吴恩达,i learned a lot
Attending Stanford University from Nairobi, Kenya.
my machine learning lecturer is so dogshit I thought this unit was impossible to understand. Now following these on study break before midsem and this guy is the best. I'd prefer that my uni just refers to these lectures rather than making their own
47:00 51:00 - batch 55:00 problem 1 set 57:00 for p 0
I didn't understand the linear regression algorithm is there any way to understand it better ??
Can I get notes for these lectures?
Why do we take the transpose of each row, wouldn't it be stacking columns on top of each other?
This is really cool. ❤
The partial derivative was incomplete to me. we should take the derivative 2/2 thetha as well? is that term a constant? shouldn't we go with the product rule!
"Wait, AI is just math?" "Always has been"
Where can I find the notes and other videos and any material related to this class!?
at 40:10, how about if we set the initial value at a point that the gradient is a negative direction, then we should increase theta rather than decrease theta?
Where do i get the assignments for these lecture series?
Why aren't we using the usual numerical methods(least squares) to fit a straight line to a given set of data points?
Andrew Ng, FTW!
Andrew讲得太好了
Which book is he using? and where do we find the homework?
Hi. Can anyone recommend any textbook that can help in further study of this course. Thank you
สุดจัดปลัดบอก
BRILIANT TECHER
why in cost function he did 1/2 and not 1/2*m ?
Does anyone know which textbook goes well with these lectures?
Thank you!
it's hard, but everything thats worth doing is
Dear Dr. Andrew I saw yours other video with the cost function with linear regression by 1/2m but this video 1/2, so what is different between it?(footnote 16:00)
I don't really understand what you mean by 1/2m. However, from my understanding, the 1/2 is just for simplicity when taking the derivative of the cost ftn the power 2 will be multiplied to the equation and cancellyby the half.
It should be 1/2m where m is the size of the data set. That's because we'd like to take the average sum of squared differences and not have the cost function depend on the size of the data set m kzhead.info/sun/jd6edNiLpKSIoo0/bejne.html He explains it here at 6:30 minutes
@@googgab It should be ok if J depends on m since m isn't changing?
same question
1:01:06 Didn't know Darth Vader attended this lectures
thank you
Very impressive. Somebody knows where are the lecture notes?
There is a link in the video description, make sure you click where it says "...more"
i wish i had access to the problem sets for this course
can anyone pls explain what do we mean by "parameters" that is denoted by theta here?
Parameters are TRAINABLE numbers in the model such as weights and bias's, since the prediction of the model is based on some combination of weight and bias values. So when 'parameters' of 'theta' are changed or 'trained', it means that the weights and bias's are changed or trained.
if board is full, slide up the board, if it refuses to go up, pull it back down, erase and continue writing on it.
Is the lecture note available publicly for this? I have been going watching this playlist and I think the lecture note will be very helpful.
cs229.stanford.edu/main_notes.pdf
Podemos dar la clase fuera?
cant download the course class note pls look onto ot
The pdf link to the problem set says Error Not found. Can someone help Please ?
how to access the lecture notes:(. they have been removed from standford websites.
In the very last equatin (Normal equation 1:18:06) Transpose(X) appears on both sides of the equation, can't this be simplified by dropping transpose(T)?
no because , x is neccesarily not a square a matrix
difficult word : cost function gradient descent convex optimization hypothesis fx target j of theta = cost/loss function partial derivatives chain row global optimum batch gradient descent stochastic gradient descent mini batch gradient descent decreasing learning rate parameters oscillating iterative algorithm normal equation trace of a
Can you update the lecture notes and assignments in the website for the course? Most of the links to the documents are broken
Hi there, thanks for your comment and feedback. The course website may be helpful to you cs229.stanford.edu/ and the notes document docs.google.com/spreadsheets/d/12ua10iRYLtxTWi05jBSAxEMM_104nTr8S4nC2cmN9BQ/edit?usp=sharing
@@stanfordonline Where can I access the problem sets?
@@stanfordonline Please post this in the description to every video. Having this in an obscure reply to a comment will only lead to people missing it while scrolling.
Does someone know how to get the lecture notes? They are not available on stanford's website.
Same issue for me alsoo....
Would anyone please share the lecture notes? On clicking on the link for the pdf notes on the course website, its showing an error that the requested URL was not found on the server. It would really be great if someone could help me with finding the class notes.
I think i found them here : chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/cs229.stanford.edu/main_notes.pdf
Wonder: Is m equals to n+1 ?n stands for number of inputs, while the m stands for the number of the rows which includes X0 in addition.
n actually stands for the number of attributes here, or the number of features (columns)
No not necessarly m is the number of rows, and n is the number of column or features. In his example n is equal to two (Size, and bedrooms), m can be any number. But i think that in the example m is 50
@Louis Aballea yeah I got it. Thanks !
The notes from the description seem to have vanished. Does anyone have them?
same problem
1.14.54 my answer is (X^T Xθ )+(X^T θ^T X)-(X^T Y)-(Y X^T) its same or my ans is wrong ?
is the explanation at 40:00 correct?
28:51, what is x0 and x1? If we have a single feature, say # of bedrooms, how can we have x0 and x1? Wouldn't x0 be just nothing? I'm confused. Or, in other words, if my Theta0 update function relies on x0 for the update, but x0 doesn't exist, theta0 will always be the initial theta0...
The value of x0 is always one 1. So theta0 can rely on x0 for the update. If we have single feature then h(X) =x0*Theta0 + x1* theta1 (which is ultimately equal to theta0 + x1*theta1 as x0=1, theta0 can also be referred as intercept and theta1 as slope if you compare it with the equation of a straight line such that price of house is linear function of # of bedrooms)
@@MahakYadav12 thank you!!
Seems like the lagrangian or path of least action theory in physics can be applied to algorythmic manipulations in machine learning as well as economics where isoquant curves and marginal analysis depend on many variables...not being an expert in any field the topics seem very similar and some corelation may exist...perhaps already being used.
Do you speak english?
Took me quite some time to realize this class was not being taught to darth vader
Had to study basic Calculus and Linear algebra at the same time to understand a bit, but don't get it fully yet,
Could you please tell me the actual use of Gradient Descent by minimizing the y(theta)?
Gradient Descent is basically the optimization model that help minimizing the cost of Model. We obtain the cost by calculating the MSE (Mean Squared Error)
anybody know where the notes are? the link doesnt work for me
Wondering if lecture notes are also available to download from somewhere ?
hey bro I found them: cs229.stanford.edu/lectures-spring2022/main_notes.pdf
@@williambrace6885thanks a lot!
where do I find the lecture notes? Help
I asked ChatGPT how to learn machine learning. #1 Coursera: Course: "Machine Learning" by Andrew Ng (Stanford University)
Very clear, but what I don't get is for the multiple data sets when I sum the errors, do I do two passes through the data and choose the error that is less?
Just continue changing theta till cost function reduces to optimal
Yes the goal Is to reach less error and by tweaking theta you can achieve that and make sure you don't overshoot
How can I implement this?? any references??
why is it that the cost function has the constant 1/2 before the summation and not 1/2m?
I think it's because he is taking one learning example and not m learning examples
@@ihebbibani7122 ah I see
hey where can i get the notes?
What's the difference between his course on coursera and the videos that are posted on here ?
His Preksha, great question! These videos are lectures from the graduate course at Stanford. Here is a link to course if you are interested: online.stanford.edu/courses/cs229-machine-learning His courses on coursera are more introductory than this graduate level course. Hope this helps, don't hesitate to get in touch with our team if you have more questions online.stanford.edu/contact-us
Short answer: The coursera version is much easier
is there thanks sitting in the class??
54:13 Normal Equation
has someone(possibly newbie like me) gone through all the videos and learnt enough to pursue an ML career or created a project? Wondering if a paid class should be taken or these free videos are enough.
i also want to know have you gone through all the videos
why even go to uni, wtf this is so much better than my lectures and it's free and it's recorded lmao wtf unis be doing they are dying fr
Fred has a one hundred sided die. Fred rolls the dice, once and gets side i. Fred then rolls the dice, again, second roll, and gets side j where side j is not side i. What is the probability of this event e? Assume the one hundred sides of the one hundred sided die all have an equal probability of facing up.
1 - (1/10000) = 9999/10000
the probability of getting the same results for two rolls and they are both defined is 1/10000. So that we will subtract that from 1
Wouldn't it be 99/100? The first roll can be any number so it doesn't really matter what's there. The second roll just needs to be one of the other 99 numbers. The first roll doesn't really change the probability. Of course, I barely know any math so I'm no expert lol
@@billr5842 you're right, the probability calculated above as 1/10000 is the probability of getting the same result for a "specific side", like getting "side 3" twice. But there are 100 different sides that has the 1/10000 probability to occur twice, so the probability 1/10000 is multiplied by the different side number 100 which makes the probability of getting the same result for two rolls equal to 1/100. Then 1 - 1/100 = 99/100
where can i find the notes?
How can I get the lecture papers pdf..?
Google
Can we get access to class lecture notes? @Stanford Online
click on show more on the description of the video. the link to class notes is the last link.
@@smn7074 Does that still work for you? It says "Not Found" when I click on a pdf link.
@@afmirror01 some of the stuff still existed but there were things removed from that website.
@@videowatching9576 those aren't the notes for the class of autumn 2018
Free at coursera
Where can I find the lecture notes? Thank you Edit: Reading through comments I got the answer:)
Where could I get that?
@govardhansathvik5897 the links are broken :(
That feel when you need to pause the video every n-minutes and need to google the terminology coz highschool was too long ago
miss the sound quality 😕😕