Docsity

Regularization, Problem of Overfitting-Machine Learning and Artificial Intelligence-Lecture Slides, Slides of Machine Learning

Partial preview of the text

Download Regularization, Problem of Overfitting-Machine Learning and Artificial Intelligence-Lecture Slides and more Slides Machine Learning in PDF only on Docsity!

Regulariza*on

The problem of

overfi6ng

Machine Learning

Example: Linear regression (housing prices) Overfi&ng: If we have too many features, the learned hypothesis may fit the training set very well ( ), but fail to generalize to new examples (predict prices on new Price Size Price Size Price Size

Addressing overfi&ng: Price Size size of house no. of bedrooms no. of floors age of house average income in neighborhood kitchen size

Addressing overfi&ng: Op*ons:

  1. Reduce number of features. ― Manually select which features to keep. ― Model selec*on algorithm (later in course).
  2. Regularizaon. ― Keep all the features, but reduce magnitude/values of parameters. ― Works well when we have a lot of features, each of which contributes a bit to predicng.

Intui3on Suppose we penalize and make , really small. Price Size of house Price Size of house

Small values for parameters ― “Simpler” hypothesis ― Less prone to overfi6ng Regulariza3on. Housing: ― Features: ― Parameters:

In regularized linear regression, we choose to minimize What if is set to an extremely large value (perhaps for too large for our problem, say )? Price Size of house

Regulariza*on

Regularized linear

regression

Machine Learning

Gradient descent Repeat

Normal equa3on

Regulariza*on

Regularized

logis*c regression

Machine Learning

Regularized logis3c regression.

Cost func*on: x 1 x 2

gradient(1) = [ ]; function [jVal, gradient] = costFunction(theta) jVal = [ ]; gradient(2) = [ ]; gradient(n+1) = [ ]; code to compute code to compute code to compute code to compute Advanced op3miza3on gradient(3) = [ code to compute ];