6.1 Advice for applying machine learning | Deciding what to try next -[Machine Learning | Andrew Ng]
 Hi and welcome back. By now you've seen a lot of different learning algorithms including linear regression, logistic regression, even deep learning or neural networks, and next week you'll see decision trees as well. So you now have a lot of powerful tools of machine learning, but how do you use these tools effectively? I've seen teams sometimes take six months to build a machine learning system that I think a more skilled team could have taken or done in just a couple of weeks. And the efficiency of how quickly you can get a machine learning system to work well will depend to a large part on how well you can repeatedly make good decisions about what to do next in the course of a machine learning project. So in this week I hope to share with you a number of tips on how to make decisions about what to do next in a machine learning project that I hope will end up saving you a lot of time. So let's take a look at some advice on how to build machine learning systems. Let's start with an example. Say you've implemented regularized linear regression to predict housing prices. So you have the usual cost function for your learning algorithm, squared error plus this regularization term. But if you train the model and find that it makes unacceptably large errors in its predictions, what do you try next? When you're building a machine learning algorithm, there are usually a lot of different things you could try. For example, you could decide to get more training examples since it seems like having more data should help, right? Or maybe you think maybe you have too many features, you could try a smaller set of features. Or maybe you want to get additional features such as find additional properties of the houses to toss into your data. And maybe that will help it to do better. Or you might take the existing features x1, x2, and so on and try adding polynomial features like x1 squared, x2 squared, x1 x2 and so on. Or you might wonder if the value of lambda is chosen well and you might say, maybe it's too big, I want to decrease it. Or you may say, oh, maybe it's too small, I want to try increasing it. So on any given machine learning application, it will often turn out that some of these things could be fruitful and some of these things not fruitful. And a key to being effective at how you build a machine learning algorithm will be if you can find a way to make good choices about where to invest your time. For example, I have seen teams spend literally many, many months collecting more training examples, thinking that more training data has got to help. But it turns out sometimes it helps a lot and sometimes it doesn't. So in this week, you learn about how to carry out a set of diagnostics. And by diagnostic, I mean a test you can run to gain insight into what is or isn't working with a learning algorithm to gain guidance into improving performance. And some of these diagnostics will tell you things like, is it worth weeks or even months collecting more training data? Because if it is, then you can then go ahead and make the investment to get more data, which will hopefully lead to improved performance. Or if it isn't, then running that diagnostic could have saved you months of time. And one thing you see this week as well is that diagnostics can take time to implement, but running them can be a very good use of your time. So this week, we'll spend a lot of time talking about different diagnostics you can use to give you guidance on how to improve your learning algorithm's performance. But first, let's take a look at how to evaluate the performance of your learning algorithm. Let's go do that in the next video.
[{"start": 0.0, "end": 4.0600000000000005, "text": " Hi and welcome back."}, {"start": 4.0600000000000005, "end": 8.8, "text": " By now you've seen a lot of different learning algorithms including linear regression, logistic"}, {"start": 8.8, "end": 14.200000000000001, "text": " regression, even deep learning or neural networks, and next week you'll see decision trees as"}, {"start": 14.200000000000001, "end": 15.200000000000001, "text": " well."}, {"start": 15.200000000000001, "end": 20.14, "text": " So you now have a lot of powerful tools of machine learning, but how do you use these"}, {"start": 20.14, "end": 22.12, "text": " tools effectively?"}, {"start": 22.12, "end": 27.080000000000002, "text": " I've seen teams sometimes take six months to build a machine learning system that I think"}, {"start": 27.08, "end": 32.04, "text": " a more skilled team could have taken or done in just a couple of weeks."}, {"start": 32.04, "end": 36.04, "text": " And the efficiency of how quickly you can get a machine learning system to work well"}, {"start": 36.04, "end": 40.8, "text": " will depend to a large part on how well you can repeatedly make good decisions about what"}, {"start": 40.8, "end": 44.16, "text": " to do next in the course of a machine learning project."}, {"start": 44.16, "end": 48.84, "text": " So in this week I hope to share with you a number of tips on how to make decisions about"}, {"start": 48.84, "end": 53.32, "text": " what to do next in a machine learning project that I hope will end up saving you a lot of"}, {"start": 53.32, "end": 54.44, "text": " time."}, {"start": 54.44, "end": 59.64, "text": " So let's take a look at some advice on how to build machine learning systems."}, {"start": 59.64, "end": 61.68, "text": " Let's start with an example."}, {"start": 61.68, "end": 66.12, "text": " Say you've implemented regularized linear regression to predict housing prices."}, {"start": 66.12, "end": 71.72, "text": " So you have the usual cost function for your learning algorithm, squared error plus this"}, {"start": 71.72, "end": 73.28, "text": " regularization term."}, {"start": 73.28, "end": 79.86, "text": " But if you train the model and find that it makes unacceptably large errors in its predictions,"}, {"start": 79.86, "end": 80.86, "text": " what do you try next?"}, {"start": 80.86, "end": 84.88, "text": " When you're building a machine learning algorithm, there are usually a lot of different things"}, {"start": 84.88, "end": 85.88, "text": " you could try."}, {"start": 85.88, "end": 90.24, "text": " For example, you could decide to get more training examples since it seems like having"}, {"start": 90.24, "end": 92.58, "text": " more data should help, right?"}, {"start": 92.58, "end": 97.64, "text": " Or maybe you think maybe you have too many features, you could try a smaller set of features."}, {"start": 97.64, "end": 102.68, "text": " Or maybe you want to get additional features such as find additional properties of the"}, {"start": 102.68, "end": 105.22, "text": " houses to toss into your data."}, {"start": 105.22, "end": 107.42, "text": " And maybe that will help it to do better."}, {"start": 107.42, "end": 112.76, "text": " Or you might take the existing features x1, x2, and so on and try adding polynomial features"}, {"start": 112.76, "end": 116.04, "text": " like x1 squared, x2 squared, x1 x2 and so on."}, {"start": 116.04, "end": 121.2, "text": " Or you might wonder if the value of lambda is chosen well and you might say, maybe it's"}, {"start": 121.2, "end": 122.76, "text": " too big, I want to decrease it."}, {"start": 122.76, "end": 127.0, "text": " Or you may say, oh, maybe it's too small, I want to try increasing it."}, {"start": 127.0, "end": 132.14, "text": " So on any given machine learning application, it will often turn out that some of these"}, {"start": 132.14, "end": 136.96, "text": " things could be fruitful and some of these things not fruitful."}, {"start": 136.96, "end": 141.96, "text": " And a key to being effective at how you build a machine learning algorithm will be if you"}, {"start": 141.96, "end": 146.56, "text": " can find a way to make good choices about where to invest your time."}, {"start": 146.56, "end": 151.76000000000002, "text": " For example, I have seen teams spend literally many, many months collecting more training"}, {"start": 151.76000000000002, "end": 156.04000000000002, "text": " examples, thinking that more training data has got to help."}, {"start": 156.04000000000002, "end": 160.12, "text": " But it turns out sometimes it helps a lot and sometimes it doesn't."}, {"start": 160.12, "end": 166.16, "text": " So in this week, you learn about how to carry out a set of diagnostics."}, {"start": 166.16, "end": 171.84, "text": " And by diagnostic, I mean a test you can run to gain insight into what is or isn't working"}, {"start": 171.84, "end": 176.2, "text": " with a learning algorithm to gain guidance into improving performance."}, {"start": 176.2, "end": 180.51999999999998, "text": " And some of these diagnostics will tell you things like, is it worth weeks or even months"}, {"start": 180.51999999999998, "end": 182.35999999999999, "text": " collecting more training data?"}, {"start": 182.35999999999999, "end": 186.88, "text": " Because if it is, then you can then go ahead and make the investment to get more data,"}, {"start": 186.88, "end": 189.07999999999998, "text": " which will hopefully lead to improved performance."}, {"start": 189.07999999999998, "end": 195.8, "text": " Or if it isn't, then running that diagnostic could have saved you months of time."}, {"start": 195.8, "end": 201.96, "text": " And one thing you see this week as well is that diagnostics can take time to implement,"}, {"start": 201.96, "end": 205.52, "text": " but running them can be a very good use of your time."}, {"start": 205.52, "end": 210.48000000000002, "text": " So this week, we'll spend a lot of time talking about different diagnostics you can use to"}, {"start": 210.48000000000002, "end": 214.32000000000002, "text": " give you guidance on how to improve your learning algorithm's performance."}, {"start": 214.32000000000002, "end": 219.16000000000003, "text": " But first, let's take a look at how to evaluate the performance of your learning algorithm."}, {"start": 219.16, "end": 226.16, "text": " Let's go do that in the next video."}]