**There's often a huge difference**between someone that really knows how to powerfully and effectively apply that algorithm, versus someone that's less familiar with some of the material and who doesn't really understand how to apply these algorithms and can end up wasting a lot of their time trying things out that don't really make sense.**If you are developing machine learning systems**, you know how to choose one of the most promising avenues to spend your time pursuing. And on this and the next few chapters are going to give a number of practical suggestions, advice, guidelines on how to do that.**And concretely what we'd focus on is the problem of**, suppose you are developing a machine learning system or trying to improve the performance of a machine learning system, how do you go about deciding what are the proxy avenues to try**To explain this, let's continue using our example of learning**to predict housing prices. And let's say you've implement and regularize linear regression. Thus minimizing that cost function J. Now suppose that after you take your learn parameters, if you test your hypothesis on the new set of houses, suppose you find that this is making huge errors in this prediction of the housing prices.**The question is what should you then try mixing in order to improve the learning algorithm?****There are many things**that one can think of that could improve the performance of the learning algorithm.**One thing they could try**, is to get more training examples. And concretely, you can imagine, maybe, you know, setting up phone surveys, going door to door, to try to get more data on how much different houses sell for.**But sometimes getting more training data**doesn't actually help and we will see how you can avoid spending a lot of time collecting more training data in settings where it is just not going to help.**Other things you might try are**to well maybe try a smaller set of features. So if you have some set of features such as x1, x2, x3 and so on, maybe a large number of features. Maybe you want to spend time carefully selecting some small subset of them to prevent overfitting.**Or maybe you need to get additional features**. Maybe the current set of features aren't informative enough and you want to collect more data in the sense of getting more features.**We can also try adding polynomial features**things like x2 square x2 square and product features x1, x2. We can still spend quite a lot of time thinking about that and we can also try other things like decreasing lambda, the regularization parameter or increasing lambda.**Given a menu of options like these**, some of which can easily scale up to six month or longer projects. Unfortunately, the most common method that people use to pick one of these is to go by gut feeling. In which what many people will do is sort of randomly pick one of these options. And easily spend six months collecting more training data or maybe someone else would rather be saying,**Fortunately, there is a pretty simple technique**that can let you very quickly rule out half of the things on this list as being potentially promising things to pursue. And there is a very simple technique, that if you run, can easily rule out many of these options, and potentially save you a lot of time pursuing something that's just is not going to work.**These are called the machine learning diagnostics.**And what a diagnostic is, is a test you can run, to get insight into what is or isn't working with an algorithm, and which will often give you insight as to what are promising things to try to improve a learning algorithm's performance.**Diagnostics can take time to implement and understand**but doing so can be a very good use of your time when you are developing learning algorithms because they can often save you from spending many months pursuing an avenue that you could have found out much earlier just was not going to be fruitful.

**Once we have done some trouble shooting**for errors in our predictions by:Getting more training examples

Trying smaller sets of features

Trying additional features

Trying polynomial features

Increasing or decreasing λ

**We can move on to evaluate our new hypothesis.****A hypothesis**may have a low error for the training examples but still be inaccurate (because of overfitting). Thus, to evaluate a hypothesis, given a dataset of training examples, we can split up the data into two sets: a training set and a test set. Typically, the training set consists of 70 % of your data and the test set is the remaining 30 %.**The new procedure**using these two sets is then:**Learn**\( \Theta \) and minimize \( J_{train}(\Theta) \) using the training set Compute the test set error \( J_{test}(\Theta) \)**The test set error :****For linear regression:**\( J_{test}(\Theta) = \frac{1}{2m_{test}} \sum_{i=1}^{m_{test}}(h_\Theta(x^{(i)}_{test}) - y^{(i)}_{test})^2 \)**For classification**~ Misclassification error (aka 0/1 misclassification error):

\( err(h_\Theta(x),y) = \begin{matrix} 1 & \mbox{if } h_\Theta(x) \geq 0.5\ and\ y = 0\ or\ h_\Theta(x) < 0.5\ and\ y = 1\newline 0 & \mbox otherwise \end{matrix} \)**This gives us a binary 0 or 1 error**result based on a misclassification. The average test error for the test set is:\( \text{Test Error} = \frac{1}{m_{test}} \sum^{m_{test}}_{i=1} err(h_\Theta(x^{(i)}_{test}), y^{(i)}_{test}) \)

**This gives us the proportion of the test data that was misclassified.**

**Just because a learning algorithm**fits a training set well, that does not mean it is a good hypothesis. It could over fit and as a result your predictions on the test set would be poor.**The error of your hypothesis**as measured on the data set with which you trained the parameters will be lower than the error on any other data set.**Given many models**with different polynomial degrees, we can use a systematic approach to identify the 'best' function. In order to choose the model of your hypothesis, you can test each degree of polynomial and look at the error result.**One way to break down**our dataset into the three sets is:**Training set:**60%**Cross validation set:**20%**Test set:**20%**We can now calculate**three separate error values for the three different sets using the following method:**Optimize the parameters**in Θ using the training set for each polynomial degree. Find the polynomial degree d with the least error using the cross validation set.**Estimate the generalization error**using the test set with \( J_{test}(\Theta^{(d)}) \), (d = theta from polynomial with lower error); This way, the degree of the polynomial d has not been trained using the test set.