linear regression
play

Linear Regression Aar$ Singh & Barnabas Poczos - PowerPoint PPT Presentation

Linear Regression Aar$ Singh & Barnabas Poczos Machine Learning 10-701/15-781 Jan 23, 2014 So far Learning distribu$ons Maximum


  1. Linear ¡Regression ¡ Aar$ ¡Singh ¡& ¡Barnabas ¡Poczos ¡ ¡ ¡ Machine ¡Learning ¡10-­‑701/15-­‑781 ¡ Jan ¡23, ¡2014 ¡

  2. So ¡far ¡… ¡ • Learning ¡distribu$ons ¡ ¡ – Maximum ¡Likelihood ¡Es$ma$on ¡(MLE) ¡ – Maximum ¡A ¡Posteriori ¡(MAP) ¡ ¡ ¡ • Learning ¡classifiers ¡ – Naïve ¡Bayes ¡ 2 ¡

  3. Discrete ¡to ¡Con3nuous ¡Labels ¡ Classification Sports ¡ Anemic ¡cell ¡ Science ¡ Healthy ¡cell ¡ News ¡ Y ¡= ¡Diagnosis ¡ X ¡= ¡Document ¡ Y ¡= ¡Topic ¡ X ¡= ¡Cell ¡Image ¡ Regression ¡ Stock ¡Market ¡ ¡ Predic$on ¡ Y ¡= ¡? ¡ X ¡= ¡Feb01 ¡ ¡ 3 ¡

  4. Regression ¡Tasks ¡ Weather ¡Predic$on ¡ Y ¡= ¡Temp ¡ X ¡= ¡7 ¡pm ¡ Es$ma$ng ¡ Contamina$on ¡ X ¡= ¡new ¡loca3on ¡ Y ¡= ¡sensor ¡reading ¡ 4 ¡

  5. Supervised ¡Learning ¡ Goal: loss function (performance measure) Sports ¡ Science ¡ Y ¡= ¡? ¡ News ¡ X ¡= ¡Feb01 ¡ ¡ Classification: Regression: ¡ Probability ¡of ¡Error Mean ¡Squared ¡Error 5 ¡

  6. Regression ¡algorithms ¡ Learning ¡algorithm ¡ Linear ¡Regression ¡ Regularized ¡Linear ¡Regression ¡– ¡Ridge ¡regression, ¡Lasso ¡ Polynomial ¡Regression ¡ Kernel ¡Regression ¡ Regression ¡Trees, ¡Splines, ¡Wavelet ¡es$mators, ¡… ¡ 6 ¡

  7. Replace ¡Expecta3on ¡with ¡Empirical ¡ Mean ¡ Optimal predictor: Empirical Minimizer: Empirical ¡mean ¡ Law of Large Numbers: n ¡ ¡ ¡ ¡ ¡ ¡ ¡∞ ¡ 7 ¡

  8. Restrict ¡class ¡of ¡predictors ¡ Optimal predictor: Empirical Minimizer: Class ¡of ¡predictors ¡ Why? ¡ ¡ ¡Overfi_ng! ¡ Y i ¡ ¡ ¡Empiricial ¡loss ¡minimized ¡by ¡any ¡ ¡ ¡ ¡func$on ¡of ¡the ¡form ¡ ¡ X i ¡ 8 ¡

  9. Restrict ¡class ¡of ¡predictors ¡ Optimal predictor: Empirical Minimizer: Class ¡of ¡predictors ¡ -­‑ Class ¡of ¡Linear ¡func$ons ¡ F -­‑ Class ¡of ¡Polynomial ¡func$ons ¡ -­‑ Class ¡of ¡nonlinear ¡func$ons ¡ 9 ¡

  10. Linear ¡Regression ¡ Least Squares Estimator -­‑ ¡Class ¡of ¡Linear ¡func$ons ¡ β 2 ¡ = ¡slope ¡ Uni-­‑variate ¡case: ¡ β 1 ¡ -­‑ ¡intercept ¡ Mul$-­‑variate ¡case: ¡ 1 ¡ where ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡ 10 ¡

  11. Least ¡Squares ¡Es3mator ¡ f ( X i ) = X i β 11 ¡

  12. Least ¡Squares ¡Es3mator ¡ 12 ¡

  13. Normal ¡Equa3ons ¡ p ¡xp ¡ p ¡x1 ¡ p ¡x1 ¡ If ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡inver$ble, ¡ ¡ When ¡is ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡inver$ble ¡? ¡ ¡ Recall: ¡Full ¡rank ¡matrices ¡are ¡inver$ble. ¡What ¡is ¡rank ¡of ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡? ¡ ¡ ¡ What ¡if ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡not ¡inver$ble ¡? ¡ ¡ Regulariza$on ¡(later) ¡ 13 ¡

  14. Gradient ¡Descent ¡ Even ¡when ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡inver$ble, ¡might ¡be ¡computa$onally ¡expensive ¡if ¡ A ¡is ¡huge. ¡ Treat ¡as ¡op$miza$on ¡problem ¡ ¡ Observa$on: ¡ ¡ ¡J(β) ¡is ¡convex ¡in ¡β. ¡ How ¡to ¡find ¡the ¡minimizer? ¡ J(β 1 ) ¡ J(β 1 , ¡β 2 ) ¡ β 1 ¡ β 1 ¡ β 2 ¡ 14 ¡

  15. Gradient ¡Descent ¡ Even ¡when ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡inver$ble, ¡might ¡be ¡computa$onally ¡expensive ¡if ¡ A ¡is ¡huge. ¡ Since ¡J( β ) ¡is ¡convex, ¡move ¡along ¡nega3ve ¡of ¡gradient ¡ step ¡size ¡ Ini$alize: ¡ ¡ ¡ Update: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡0 ¡if ¡ ¡ ¡ ¡ ¡ ¡= ¡ ¡ ¡ Stop: ¡ ¡when ¡some ¡criterion ¡met ¡e.g. ¡fixed ¡# ¡itera$ons, ¡or ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡< ¡ ε . ¡ ¡ 15 ¡

  16. Effect ¡of ¡step-­‑size ¡ α ¡ Large ¡ α ¡ ¡=> ¡Fast ¡convergence ¡but ¡larger ¡residual ¡error ¡ ¡Also ¡possible ¡oscilla$ons ¡ ¡ Small ¡ α ¡ ¡=> ¡Slow ¡convergence ¡but ¡small ¡residual ¡error ¡ ¡ ¡ ¡ ¡ 16 ¡

  17. Least ¡Squares ¡and ¡MLE ¡ Intui$on: ¡Signal ¡plus ¡(zero-­‑mean) ¡Noise ¡model ¡ = X β ∗ log ¡likelihood ¡ Least Square Estimate is same as Maximum Likelihood Estimate under a Gaussian model ! 17 ¡

  18. Regularized ¡Least ¡Squares ¡and ¡MAP ¡ What ¡if ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡not ¡inver$ble ¡? ¡ ¡ log ¡likelihood ¡ log ¡prior ¡ I) ¡Gaussian ¡Prior ¡ 0 ¡ Ridge Regression b A > A A > Y I ) � 1 A β MAP = ( A A A + λ I A I A Y Y 18 ¡

  19. Regularized ¡Least ¡Squares ¡and ¡MAP ¡ What ¡if ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡not ¡inver$ble ¡? ¡ ¡ log ¡likelihood ¡ log ¡prior ¡ I) ¡Gaussian ¡Prior ¡ 0 ¡ Ridge Regression Prior ¡belief ¡that ¡β ¡is ¡Gaussian ¡with ¡zero-­‑mean ¡biases ¡solu$on ¡to ¡“small” ¡β ¡ 19 ¡

  20. Regularized ¡Least ¡Squares ¡and ¡MAP ¡ What ¡if ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡not ¡inver$ble ¡? ¡ ¡ log ¡likelihood ¡ log ¡prior ¡ II) ¡Laplace ¡Prior ¡ Lasso Prior ¡belief ¡that ¡β ¡is ¡Laplace ¡with ¡zero-­‑mean ¡biases ¡solu$on ¡to ¡“small” ¡β ¡ 20 ¡

  21. Ridge ¡Regression ¡vs ¡Lasso ¡ Ridge ¡Regression: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Lasso: ¡ Ideally ¡l0 ¡penalty, ¡ ¡ HOT! ¡ but ¡op$miza$on ¡ ¡ ¡ ¡ ¡ ¡ becomes ¡non-­‑convex ¡ β s ¡with ¡constant ¡ J ( β ) ¡ (level ¡sets ¡of ¡ J ( β )) ¡ β 2 ¡ β s ¡with ¡ ¡ β s ¡with ¡ ¡ β s ¡with ¡ ¡ constant ¡ ¡ constant ¡ ¡ constant ¡ ¡ l2 ¡norm ¡ l1 ¡norm ¡ l0 ¡norm ¡ β 1 ¡ Lasso ¡(l1 ¡penalty) ¡results ¡in ¡sparse ¡solu3ons ¡– ¡vector ¡with ¡more ¡zero ¡coordinates ¡ Good ¡for ¡high-­‑dimensional ¡problems ¡– ¡don’t ¡have ¡to ¡store ¡all ¡coordinates! ¡ 21 ¡

  22. Beyond ¡Linear ¡Regression ¡ Polynomial ¡regression ¡ ¡ ¡ Regression ¡with ¡nonlinear ¡features ¡ ¡ ¡ ¡ Later ¡… ¡ ¡ Kernel ¡regression ¡-­‑ ¡Local/Weighted ¡regression ¡ ¡ 26 ¡

  23. Polynomial ¡Regression ¡ degree ¡m ¡ Univariate ¡(1-­‑dim) ¡ ¡ case: ¡ where ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡ β 0 + β 1 X (1) + β 2 X (2) + · · · + β p X ( p ) MulGvariate ¡(p-­‑dim) ¡ ¡ f ( X ) = case: ¡ p p p p p β ij X ( i ) X ( j ) + X X X X X X ( i ) X ( j ) X ( k ) + i =1 j =1 i =1 j =1 k =1 + . . . terms up to degree m 27 ¡

  24. Polynomial ¡Regression ¡ Polynomial ¡of ¡order ¡k, ¡equivalently ¡of ¡degree ¡up ¡to ¡k-­‑1 ¡ 1.5 1.4 k=1 ¡ k=2 ¡ 1.2 1 1 0.8 0.6 0.5 0.4 0.2 0 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.4 5 k=3 ¡ k=7 ¡ 0 1.2 -5 1 -10 0.8 -15 0.6 -20 ¡ What ¡is ¡the ¡right ¡order? ¡Recall ¡overfiPng! ¡More ¡later ¡… ¡ -25 0.4 -30 0.2 ¡ -35 0 -40 28 ¡ -0.2 -45 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

  25. Regression ¡with ¡nonlinear ¡features ¡ Weight of Nonlinear each feature features In ¡general, ¡use ¡any ¡nonlinear ¡features ¡ ¡ ¡ ¡e.g. ¡e X , ¡log ¡X, ¡1/X, ¡sin(X), ¡… ¡ 29 ¡

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