Link to Coursera - Deeplearning.AI Machine Learning Course: Link.
Instructor: Andrew Ng.
Andrew Ng’s personal webpage: Link.
Course - 1 : Supervised Machine Learning : Regression and Classification
ROUGH NOTES (!)
Updated: 20/9/2026
[Welcome to machine learning!]
(These are rough notes of what the instructor mentions).
What is machine learning?
You probably use it many times a day without even knowing it.
Web search: Anytime you want to find out something like how do I make a sushi roll? You can do a web search on Google to find out. And that works so well because their machine learning software has figured out how to rank web pages.
Photo recognition: When you upload pictures to Instagram and think to yourself, I want to tag my friends so they can see their pictures. Well, these apps can recognize your friends in your pictures and label them as well. That’s also machine learning.
Movie recommendation: If you’ve just finished watching a Star Wars movie on a video streaming service and you think what other similar movies can I watch? Well, the streaming service will likely use machine learning to recommend something that you might like.
Voice to text: Each time you use voice to text on your phone to write a text message, or maybe tell your phone “Hey Siri, play a song by Rihanna”, that’s also machine learning.
Spam flagging: Each time you recieve an email titled “Congratulations! You’ve won a million dollars”. Well, maybe you’re rich, congratulations. Or more likely your email service will probably flag it as spam. That too is an application of machine learning.
Beyond consumer applications that you might use, AI is also rapidly making its way into big companies and into industrial applications.
Optimize wind power generation: For eg, I’m deeply concerned about climate change, and machine learning is already helping to optimize wind turbine power generation.
Healthcare diagnostics: Machine learning is starting to make its way into hospitals to help doctors make accurate diagnosis.
Intuition: It seems like making the right diagnosis can be a hurdle. Once a diagnosis is made, the methods of treatment might be straightforward.
Detecting manufacturing defects: At LandingAI, I’ve been doing a lot of work, for putting computer vision into factories to help inspect if something coming off the assembly line has any defects.
That’s machine learning.
Machine learning is the science of getting computers to learn without being explicitly programmed.
In this course, you will learn about machine learning and get to implement machine learning algorithms and code yourself.
(Millions of others have taken an earlier version of this course, and that led to the founding of Coursera).
Welcome and let’s get started.
[Applications of machine learning]
In this class, you’ll learn about the state of the art and also practice implementing machine learning algorithms yourself.
Beyond learning the algorithms, you’ll also learn all the important practical tips and tricks for making them perform well.
Why is machine learning so widely used today?
Machine Learning had grown up as a sub-field of AI or artificial intelligence. We wanted to build intelligent machines.
It turns out that there are a few basic things that we could program a machine to do, such as how to find the shortest path from a to b, like in your GPS. But for the most part, we just did not know how to write an explicit program to do many of the more interesting things, such as perform web search, recognize human speech, diagnose diseases from X-rays or build a self-driving car. The only way we knew how to do these things was to have a machine learn to do it by itself.
Instructor: Andrew Ng’s work. For me, when I founded and was leading the Google Brain Team, I worked on problems like speech recognition, computer vision for Google Maps, Street View images and advertising. When leading AI Baidu, I worked on everything from AI for augmented reality to combating payment fraud to leading a self-driving car team. Most recently, at landing.AI, AI Fund and Stanford University, I’m beginning to work on AI applications in the factory, large-scale agriculture, health care, e-commerce, and other problems. Today, there are hundreds of thousands, perhaps millions of people working on machine learning applications who could tell you similar stories about their work with machine learning.
Instructor: Potential applications. When you’ve learned these skills, I hope that you too will find the great fun to dabble in exciting different applications and maybe even different industries. In fact, I find it hard to think of any industry that machine learning is unlikely to touch in a significant way now or in the near future.
Instructor: Potential for AGI. Looking even further into the future, many people, including me, are excited about the AI dream of someday building machines as intelligent as you or me. This is sometimes called Artificial General Intelligence or AGI. I think AGI has been overhyped and we’re still a long way away from that goal. I don’t know. It’ll take 50 years or 500 years or longer to get there. But mostly AI researchers believe that the best way to get closer toward that goal is by using learning algorithms. Maybe ones that take some inspiration from how the human brain works.
Instructor: Potential applications. According to a study by McKinsey, AI and machine learning is estimated to create an additional 13 trillion US dollars of value annually by the year 2030. Even though machine learning is already creating tremendous amounts of value in the software industry, I think there could be even vastly greater value that has yet to be created outside the software industry in sectors such as retail, travel, transportation, automotive, materials manufacturing, and so on. Because of the massive untapped opportunities across so many different sectors, today there is a vast unfulfilled demand for this skill set. That’s why this is such a great time to be learning about machine learning. If you find machine learning applications exciting, I hope you stick with me through this class.
[What is machine learning?]
What is machine learning?
“Field of study that gives computers the ability to learn without being explicitly programmed.” - Arthur Samuel (1959)
Personal: The definition doesn’t seem to include what it means to learn.
Instructor: Samuel’s claim to fame was that back in the 1950s, he wrote a checkers playing program. The amazing thing about this program was that Arthur Samuel himself wasn’t a very good checkers player. What he did was he had programmed the computer to play maybe tens of thousands of games against itself.
Instructor: By watching what sort of board positions tend to lead to wins and what positions tend to lead to losses, the checkers playing program learned over time what are good or bad board positions. By trying to get a good and avoid a bad position, this program learned to get better and better at playing checkers. As mentioned, it played maybe tens of thousands of games against itself. It was able to get so much checkers playing experience that eventually it became a better checkers player than Samuel himself.
Personal: How exactly did he do this?
Q) If the checkers program had been allowed to play only ten games (instead of tens of thousands) against itself, a much smaller number of games, how would this have affected its performance?
-
Option 1: Would have made it better.
-
Option 2: Would have made it worse.
A) Option 2: Would have made it worse.
In general, the more opportunities you give a learning algorithm to learn, the better it will perform. ${ \blacksquare }$
Two main types of machine learning algorithms are:
-
Supervised learning.
-
Unsupervised learning.
We will look at their definitions later.
Of these two, Supervised learning is:
-
Used most in real world applications.
-
Has seen the most rapid advancements and innovation.
In this course we will focus on:
-
Courses 1, 2 : Supervised learning.
-
Course 3 : Unsupervised learning, Recommender systems, Reinforcement learning.
We will also focus on practical advice for applying learning algorithms.
Instructor: This is something I feel pretty strongly about. Teaching about learning algorithms is like giving someone a set of tools. Equally important, infact even more important, than making sure you have great tools, is making sure you know how to apply them. Because what good is it if someone gives you a state-of-the-art hammer or a state-of-the-art hand drill and says good luck. Now you have all the tools you need to build a three-storey house. It doesn’t really work like that. Similarly in machine learning, making sure you have the tools is really important and so is making sure that you know how to apply the tools of machine learning effectively. That’s what you get in this class, the tools as well as the skills to apply them effectively.
Instructor: I regularly visit with friends and teams in some of the top tech companies, and even today I see experienced machine learning teams apply machine learning algorithms to some problems, and sometimes they’ve been going at it for six months without much success. When I look at what they’re doing, I sometimes feel like I could have told them six months ago that the current approach won’t work and there’s a different way of using these tools that will give them a much better chance of success. In this class, one of the relatively unique things you learn is you learn a lot about the best practices for how to actually develop a practical, valuable machine learning system.
Instructor: This way, you’re less likely to end up in one of those teams that end up losing six months going in the wrong direction. In this class, you gain a sense of how the most skilled machine learning engineers build systems. I hope you finish this class as one of those very rare people in today’s world that know how to design and build serious machine learning systems.
[Supervised learning part 1]
Machine learning is creating tremendous economic value today.
I think 99 % of the economic value created by machine learning today is though one type of machine learning, called supervised learning.
What is supervised learning?
Supervised learning refers to algorithms that learn ${ x \to y ,}$ ${ \text{input} \to \text{output label} }$ mappings.
The key characteristic of supervised learning is that you give your learning algorithms examples to learn from. Examples include “right answers”, where by right answer, I mean the correct label ${ y }$ for a given input ${ x .}$ It is by seeing correct pairs of input ${ x }$ and desired output label ${ y }$ that the learning algorithm eventually learns to take just the input alone without the output label and gives a reasonably accurate prediction or guess of the output.
Some examples.
| Input (X) | Output (Y) | Application |
|---|---|---|
| spam? (0/1) | spam filtering | |
| audio | text transcripts | speech recognition |
| English | Spanish | machine translation |
| ad, user info | click? (0/1) | online advertising |
| image, radar info | position of other cars | self-driving car |
| image of phone | defect? (0/1) | visual inspection |
Instructor: On online advertising. The most lucrative form of supervised learning today is probably used in online advertising. Nearly all the large online ad platforms have a learning algorithm that inputs some information about an ad and some information about you and then tries to figure out if you will click on that ad or not. Because by showing you ads they’re just slightly more likely to click on, for these large online ad platforms, every click is revenue, this actually drives a lot of revenue for these companies.
Instructor: This is something I once did a lot of work on, maybe not the most inspiring application, but it certainly has a significant economic impact in some countries today.
Instructor: On self-driving car. If you want to build a self-driving car, the learning algorithm would take as input an image and some information from other sensors such as a radar or other things, and then try to output the position of, say, other cars so that your self-driving car can safely drive around the other cars.
Instructor: On manufacturing. I’ve actually done a lot of work in this sector at landing AI. You can have a learning algorithm takes as input a picture of a manufactured product, say a cell phone that just rolled off the production line and have the learning algorithm output whether or not there is a scratch, dent, or other defect in the product. This is called visual inspection and it’s helping manufacturers reduce or prevent defects in their products.
In all of these applications, you will first train your model with examples of inputs x and the right answers, that is the labels y. After the model has learned from these input, output, or x and y pairs, they can then take a brand new input x, something it has never seen before, and try to produce the appropriate corresponding output y.
Personal: On supervised learning. It seems in supervised learning we are given example input-output label pairs ${ \lbrace (x _i, y _i) \rbrace }$ and we want to find a good fit ${ f(x) }$ where for any ${ x , }$ ${ f(x) }$ is a random variable. (We might want to let the fit give different outputs when given the same input repeatedly. For eg, in machine translation, speech recognition, etc. we might by design get different outputs when the same input is given repeatedly). But many definitions, like the one in wikipedia, link, and in the notes linked here, link, seem to look for a function fit. Tldr: How do we think of machine translation, speech recognition, where giving the same input repeatedly can produce different outputs, in the framework of supervised learning? I should maybe ask this in the deeplearning.ai community.
Personal: Posted the question. Link to the question: Link.
TMosh: Machine translation, speech recognition, etc. require more complicated models than the simple supervised learning model. However those complicated models are still based on creating a good fit between a set of data and the model’s predicted outputs.
Example.
Say you want to predict housing prices based on the size of the house. You’ve collected some data and say you plot the data (House size vs Price) and it looks like this.
Instructor: Yes, I live in the United States where we still use square feet. I know most of the world uses square meters.
WIth this data, let’s say a friend wants to know what’s the price for their 750 sq ft house.
How can a learning algorithm help you?
One thing a learning algorithm might be able to do is fit a straight line through the data, and reading off the straight line, it looks like your friend’s house could be sold for maybe about $ 150,000.
But fitting a straight line isn’t the only learning algorithm you can use. There are others that could work better for this application. For example, rather than fitting a straight line, you might decide it’s better to fit a curve, a function that’s slightly more complicated than a straight line.
If you do that and make a prediction here, it looks like your friend’s house could be sold for closer to $ 200,000.
You’ll see later how you can decide whether to fit a straight line, a curve, or another function that is even more complex to the data.
What you’ve seen is an example of supervised learning. Note that we gave the algorithm a dataset in which the so-called right answer, that is the label or the correct price y, is given for every house on the plot. The task of the learning algorithm is to produce more of these right answers, specifically predicting what is the likely price for other houses like your friend’s house. That’s why this is supervised learning.
To define a little bit more terminology, this housing price prediction is the particular type of supervised learning called regression.
Instructor: By regression, I mean we’re trying to predict a number from infinitely many possible numbers, such as the house prices in our example, which could be 150,000 or 70,000 or 183,000 or any other number in between.