svms duality and the kernel trick cont
play

SVMs, Duality and the Kernel Trick (cont.) Machine Learning - PowerPoint PPT Presentation

Two SVM tutorials linked in class website (please, read both): High-level presentation with applications (Hearst 1998) Detailed tutorial (Burges 1998) SVMs, Duality and the Kernel Trick (cont.) Machine Learning 10701/15781 Carlos


  1. Two SVM tutorials linked in class website (please, read both): � High-level presentation with applications (Hearst 1998) � Detailed tutorial (Burges 1998) SVMs, Duality and the Kernel Trick (cont.) Machine Learning – 10701/15781 Carlos Guestrin Carnegie Mellon University March 1 st , 2006 � � 2006 Carlos Guestrin

  2. SVMs reminder � � 2006 Carlos Guestrin

  3. Today’s lecture � Learn one of the most interesting and exciting recent advancements in machine learning � The “kernel trick” � High dimensional feature spaces at no extra cost! � But first, a detour � Constrained optimization! � � 2006 Carlos Guestrin

  4. Dual SVM interpretation 0 = b + x . w � � 2006 Carlos Guestrin

  5. Dual SVM formulation – the linearly separable case � � 2006 Carlos Guestrin

  6. Reminder from last time: What if the data is not linearly separable? Use features of features of features of features…. Feature space can get really large really quickly! � � 2006 Carlos Guestrin

  7. Higher order polynomials m – input features d – degree of polynomial number of monomial terms d=4 d=3 d=2 grows fast! d = 6, m = 100 number of input dimensions about 1.6 billion terms � � 2006 Carlos Guestrin

  8. Dual formulation only depends on dot-products, not on w ! � � 2006 Carlos Guestrin

  9. Finally: the “kernel trick”! � Never represent features explicitly � Compute dot products in closed form � Constant-time high-dimensional dot- products for many classes of features � Very interesting theory – Reproducing Kernel Hilbert Spaces � Not covered in detail in 10701/15781, more in 10702 � � 2006 Carlos Guestrin

  10. Common kernels � Polynomials of degree d � Polynomials of degree up to d � Gaussian kernels � Sigmoid �� � 2006 Carlos Guestrin

  11. Overfitting? � Huge feature space with kernels, what about overfitting??? � Maximizing margin leads to sparse set of support vectors � Some interesting theory says that SVMs search for simple hypothesis with large margin � Often robust to overfitting �� � 2006 Carlos Guestrin

  12. What about at classification time � For a new input x , if we need to represent Φ ( x ), we are in trouble! � Recall classifier: sign( w . Φ ( x )+b) � Using kernels we are cool! �� � 2006 Carlos Guestrin

  13. SVMs with kernels � Choose a set of features and kernel function � Solve dual problem to obtain support vectors α i � At classification time, compute: Classify as �� � 2006 Carlos Guestrin

  14. Remember kernel regression Remember kernel regression??? w i = exp(-D(x i , query) 2 / K w 2 ) 1. How to fit with the local points? 2. Predict the weighted average of the outputs: predict = � w i y i / � w i �� � 2006 Carlos Guestrin

  15. SVMs v. Kernel Regression SVMs Kernel Regression or �� � 2006 Carlos Guestrin

  16. SVMs v. Kernel Regression SVMs Kernel Regression or Differences: � SVMs: � Learn weights \alpha_i (and bandwidth) � Often sparse solution � KR: � Fixed “weights”, learn bandwidth � Solution may not be sparse � Much simpler to implement �� � 2006 Carlos Guestrin

  17. What’s the difference between SVMs and Logistic Regression? SVMs Logistic Regression Loss function Hinge loss Log-loss High dimensional Yes! No features with kernels �� � 2006 Carlos Guestrin

  18. Kernels in logistic regression � Define weights in terms of support vectors: � Derive simple gradient descent rule on α i �� � 2006 Carlos Guestrin

  19. What’s the difference between SVMs and Logistic Regression? (Revisited) SVMs Logistic Regression Loss function Hinge loss Log-loss High dimensional Yes! Yes! features with kernels Solution sparse Often yes! Almost always no! Semantics of “margin” Real probabilities output �� � 2006 Carlos Guestrin

  20. What you need to know � Dual SVM formulation � How it’s derived � The kernel trick � Derive polynomial kernel � Common kernels � Kernelized logistic regression � Differences between SVMs and logistic regression �� � 2006 Carlos Guestrin

  21. Acknowledgment � SVM applet: � http://www.site.uottawa.ca/~gcaron/applets.htm �� � 2006 Carlos Guestrin

  22. More details: General: http://www.learning-with-kernels.org/ Example of more complex bounds: http://www.research.ibm.com/people/t/tzhang/papers/jmlr02_cover.ps.gz PAC-learning, VC Dimension and Margin-based Bounds Machine Learning – 10701/15781 Carlos Guestrin Carnegie Mellon University March 1 st , 2005 �� � 2006 Carlos Guestrin

  23. What now… � We have explored many ways of learning from data � But… � How good is our classifier, really? � How much data do I need to make it “good enough”? �� � 2006 Carlos Guestrin

  24. A simple setting… � Classification � m data points � Finite number of possible hypothesis (e.g., dec. trees of depth d) � A learner finds a hypothesis h that is consistent with training data � Gets zero error in training – error train ( h ) = 0 � What is the probability that h has more than ε true error? � error true ( h ) � ε �� � 2006 Carlos Guestrin

  25. How likely is a bad hypothesis to get m data points right? � Hypothesis h that is consistent with training data � got m i.i.d. points right � Prob. h with error true (h) � ε gets one data point right � Prob. h with error true (h) � ε gets m data points right �� � 2006 Carlos Guestrin

  26. But there are many possible hypothesis that are consistent with training data �� � 2006 Carlos Guestrin

  27. How likely is learner to pick a bad hypothesis � Prob. h with error true (h) � ε gets m data points right � There are k hypothesis consistent with data � How likely is learner to pick a bad one? �� � 2006 Carlos Guestrin

  28. Union bound � P(A or B or C or D or …) �� � 2006 Carlos Guestrin

  29. How likely is learner to pick a bad hypothesis � Prob. h with error true (h) � ε gets m data points right � There are k hypothesis consistent with data � How likely is learner to pick a bad one? �� � 2006 Carlos Guestrin

  30. Review: Generalization error in finite hypothesis spaces [Haussler ’88] � Theorem : Hypothesis space H finite, dataset D with m i.i.d. samples, 0 < ε < 1 : for any learned hypothesis h that is consistent on the training data: �� � 2006 Carlos Guestrin

  31. Using a PAC bound � Typically, 2 use cases: � 1: Pick ε and δ , give you m � 2: Pick m and δ , give you ε �� � 2006 Carlos Guestrin

  32. Review: Generalization error in finite hypothesis spaces [Haussler ’88] � Theorem : Hypothesis space H finite, dataset D with m i.i.d. samples, 0 < ε < 1 : for any learned hypothesis h that is consistent on the training data: Even if h makes zero errors in training data, may make errors in test �� � 2006 Carlos Guestrin

  33. Limitations of Haussler ‘88 bound � Consistent classifier � Size of hypothesis space �� � 2006 Carlos Guestrin

  34. What if our classifier does not have zero error on the training data? � A learner with zero training errors may make mistakes in test set � What about a learner with error train ( h ) in training set? �� � 2006 Carlos Guestrin

  35. Simpler question: What’s the expected error of a hypothesis? � The error of a hypothesis is like estimating the parameter of a coin! � Chernoff bound: for m i.d.d. coin flips, x 1 ,…,x m , where x i � {0,1}. For 0< ε <1: �� � 2006 Carlos Guestrin

  36. Using Chernoff bound to estimate error of a single hypothesis �� � 2006 Carlos Guestrin

  37. But we are comparing many hypothesis: Union bound For each hypothesis h i : What if I am comparing two hypothesis, h 1 and h 2 ? �� � 2006 Carlos Guestrin

  38. Generalization bound for |H| hypothesis � Theorem : Hypothesis space H finite, dataset D with m i.i.d. samples, 0 < ε < 1 : for any learned hypothesis h : �� � 2006 Carlos Guestrin

  39. PAC bound and Bias-Variance tradeoff or, after moving some terms around, with probability at least 1- δ δ δ δ: : : : � Important: PAC bound holds for all h, but doesn’t guarantee that algorithm finds best h !!! �� � 2006 Carlos Guestrin

  40. What about the size of the hypothesis space? � How large is the hypothesis space? �� � 2006 Carlos Guestrin

  41. Boolean formulas with n binary features �� � 2006 Carlos Guestrin

  42. Number of decision trees of depth k Recursive solution Given n attributes H k = Number of decision trees of depth k H 0 =2 H k+1 = (#choices of root attribute) * (# possible left subtrees) * (# possible right subtrees) = n * H k * H k Write L k = log 2 H k L 0 = 1 L k+1 = log 2 n + 2L k So L k = (2 k -1)(1+log 2 n) +1 �� � 2006 Carlos Guestrin

  43. PAC bound for decision trees of depth k � Bad!!! � Number of points is exponential in depth! � But, for m data points, decision tree can’t get too big… Number of leaves never more than number data points �� � 2006 Carlos Guestrin

  44. Number of decision trees with k leaves H k = Number of decision trees with k leaves H 0 =2 Loose bound: Reminder: �� � 2006 Carlos Guestrin

  45. PAC bound for decision trees with k leaves – Bias-Variance revisited �� � 2006 Carlos Guestrin

Recommend


More recommend