linear regression via normal equations
play

Linear Regression via Normal Equations some material thanks to - PowerPoint PPT Presentation

Linear Regression via Normal Equations some material thanks to Andrew Ng @Stanford Course Map / module1 LEARNING PERFORMANCE REPRESENTATION DATA PROBLEM RAW DATA EVALUATION FEATURES CLUSTERING housing data spam data ANALYSIS SELECTION


  1. Linear Regression via Normal Equations some material thanks to Andrew Ng @Stanford

  2. Course Map / module1 LEARNING PERFORMANCE REPRESENTATION DATA PROBLEM RAW DATA EVALUATION FEATURES CLUSTERING housing data spam data ANALYSIS SELECTION SUPERVISED LABELS LEARNING TUNING decision tree DATA DIMENSIONS linear regression PROCESSING • two basic supervised learning algorithms - decision trees - linear regression • two simple datasets - housing - spam emails

  3. Module 1 Objectives / Linear Regression • Linear Algebra Primer - matrix equations, notations - matrix manipulations • Linear Regression - objective, convexity - matrix form - derivation of normal equations • Run regression in practice

  4. Matrix data x x x13 … … x1d datapoint x21 x22 x23 … … x2d … xm1 xm2 xm3 … … xmd feature • m datapoints/objects Xi=(x1,x2,…,xd); i=1:m • d features/columns f1, f2, …, fd • label(X i ) = y i, given for each datapoint in the training set.

  5. Matrix data / training VS testing Training Testing

  6. regression goal • housing data, two features (toy example) � � � � � • regressor = a linear predictor � � • such that h(x) approximates label(x)=y as close as possible, measured by square error

  7. Regression Normal Equations • Linear regression has a well known exact solution, given by linear algebra � • X= training matrix of feature values • Y= corresponding labels vector � • then regression coefficients that minimize objective J are

  8. Normal equations : matrix derivatives • if function f takes a matrix and outputs a real number, then its derivative is � � � • example:

  9. Normal equations : matrix trace • trace(A) = sum of main diagonal � • easy properties � � � � • advanced properties

  10. regression checkpoint : matrix derivative and trace • 1) in the example few slides ago explain how the matrix of derivatives was calculated � � � � • 2) derive on paper the first three advanced matrix trace properties

  11. Normal equations : mean square error • data and labels � � � • error (difference) for regressor � � � • square error

  12. Normal equations : mean square error di fg erential • minimize J =>set the derivative to zero:

  13. linear regression : use on test points • x=(x 1 ,x 2 ,…,x d ) test point • h = ( θ 0 , θ 1 ,…, θ d ) regression model • apply regressor to get a predicted label (add bias feature x 0 =1) � � � • if y=label(x) is given, measure error - absolute difference |y-h(x)| - square error (y-h(x)) 2

  14. Logistic regression • Logistic • Logistic differential transformation

  15. Logistic regression • Logistic regression function � � � � • Solve the same optimization problem as before - no exact solution this time, will use gradient descent (numerical methods) next module

  16. Linear Regression Screencast • http://www.screencast.com/t/U3usp6TyrOL

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend