{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs229-notes5 - CS229 Lecture notes Andrew Ng Part VI...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS229 Lecture notes Andrew Ng Part VI Regularization and model selection Suppose we are trying select among several different models for a learning problem. For instance, we might be using a polynomial regression model h θ ( x ) = g ( θ 0 + θ 1 x + θ 2 x 2 + · · · + θ k x k ), and wish to decide if k should be 0, 1, . . . , or 10. How can we automatically select a model that represents a good tradeoff between the twin evils of bias and variance 1 ? Alternatively, suppose we want to automatically choose the bandwidth parameter τ for locally weighted regression, or the parameter C for our 1 -regularized SVM. How can we do that? For the sake of concreteness, in these notes we assume we have some finite set of models M = { M 1 , . . . , M d } that we’re trying to select among. For instance, in our first example above, the model M i would be an i -th order polynomial regression model. (The generalization to infinite M is not hard. 2 ) Alternatively, if we are trying to decide between using an SVM, a neural network or logistic regression, then M may contain these models. 1 Given that we said in the previous set of notes that bias and variance are two very different beasts, some readers may be wondering if we should be calling them “twin” evils here. Perhaps it’d be better to think of them as non-identical twins. The phrase “the fraternal twin evils of bias and variance” doesn’t have the same ring to it, though. 2 If we are trying to choose from an infinite set of models, say corresponding to the possible values of the bandwidth τ R + , we may discretize τ and consider only a finite number of possible values for it. More generally, most of the algorithms described here can all be viewed as performing optimization search in the space of models, and we can perform this search over infinite model classes as well. 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 1 Cross validation Lets suppose we are, as usual, given a training set S . Given what we know about empirical risk minimization, here’s what might initially seem like a algorithm, resulting from using empirical risk minimization for model selec- tion: 1. Train each model M i on S , to get some hypothesis h i . 2. Pick the hypotheses with the smallest training error. This algorithm does not work. Consider choosing the order of a poly- nomial. The higher the order of the polynomial, the better it will fit the training set S , and thus the lower the training error. Hence, this method will always select a high-variance, high-degree polynomial model, which we saw previously is often poor choice. Here’s an algorithm that works better. In hold-out cross validation (also called simple cross validation ), we do the following: 1. Randomly split S into S train (say, 70% of the data) and S cv (the remain- ing 30%). Here, S cv is called the hold-out cross validation set.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern