1 / 97

Ch15 Support Vector Machines and Machine Learning on documents

Ch15 Support Vector Machines and Machine Learning on documents. 2010. 1. 25. 최성빈. Introduction. 최근 20 년 간 , 분류기의 효과성을 향상시키기 위한 연구의 결실로 , support vector machine, boosted decision tree, regularized logistic regression, neural network, random forest 와 같이 새로운 분류기들이 등장했다 .

palmer
Télécharger la présentation

Ch15 Support Vector Machines and Machine Learning on documents

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ch15 Support Vector Machines andMachine Learning on documents 2010. 1. 25. 최성빈

  2. Introduction • 최근 20년 간, 분류기의 효과성을 향상시키기 위한 연구의 결실로, support vector machine, boosted decision tree, regularized logistic regression, neural network, random forest와 같이 새로운 분류기들이 등장했다. • 이러한 방법론 중 다수는, 정보검색문제 특히 문헌분류에 적용되어, 성공적인 모습을 보여왔다. • SVM은 large-margin classifier의 하나이다. • SVM은 vector space기반의 machine learning 기법이다. • SVM의 목적 training data에서, 두 클래스의 어떤 point로부터도 최대한 멀리 떨어져 있는, 두 클래스 간의 decision boundary를 찾는 것

  3. Introduction • 다른 machine learning기법이 이 작업에 적용된바 있음에도, SVM의 사용이 두드러져 왔다. • SVM이 항상 다른 machine learning기법보다 좋은 것은 아니지만, 가장 최신의 성능을 보여주고 있으며, 현재 이론적 및 실험적인 측면에서 많은 매력을 가지고 있다.

  4. Introduction • 15.1 Support vector machines: The linearly separable case : two-class data sets, separable by a linear classifier • 15.2 Extensions to the SVM model : multiclass problem, non-separable data, nonlinear models, other issues • 15.3 Issues in the classification of text documents • 15.4 Machine learning methods in ad hoc information retrieval

  5. 15.1 Support vector machines:The linearly separable case • 14.8의그림에서와 같이 two-class의 분리가능한 training data set에서 많은 수의 선형 분류기가 존재한다. • 직관적으로, 두 클래스의 data item들 가운데를 지나는 decision boundary가, 하나 혹은 두 클래스와 매우 가깝게 지나가는 decision boundary보다 좋아 보인다.

  6. 15.1 Support vector machines:The linearly separable case • 퍼셉트론, Naïve Bayes와 같은 학습기법들은, 특정 기준에 따라 가장 성능이 좋은 어떤 선형분류기를 찾는다. • 특히 SVM은, 그 기준을, 어떤 data point로부터도 가장 멀리 떨어져 있는 결정면(decision surface)을 찾는 것으로 정의한다.

  7. 15.1 Support vector machines:The linearly separable case • 결정면에서 가장 가까운 data point와 결정면과의 거리가, 분류기의 margin이 된다. • SVM의 분류기의 위치를 정의하는 decision function은, data point의 일부분으로 특정지을 수 있다. - 이 data point들을 support vectors라고 한다. • support vector외의 다른 data point들은 결정면을 선택하는데 있어 아무 역할을 하지 못한다.

  8. 15.1 Support vector machines:The linearly separable case • 결정면 근처에 data point가 위치한다는 것이 매우 불확실한 분류 결정을 의미하기 때문에, margin을 최대화하는 것은 좋은 것이다. • 큰 margin을 가지는 분류기는, 확실성이 낮은 분류 판단을 내릴 가능성이 없어진다. • 이것은 classification safety margin을 제공한다. : slight error in measurement나 slight document variation이 있더라도, 이것이 오분류로 이어지지 않는다.

  9. 15.1 Support vector machines:The linearly separable case • SVM분류기는 결정면 근처에서 large margin을 제공한다. • decision hyperplane과 비교해서, 클래스 사이에 fat separator를 위치한다면 그것을 어디에 위치할지에 대해 적은 가지 수의 선택권을 가지게 된다. • 그 결과로, 모델의 memory capacity가 감소하고, 따라서 test data로의 정확하게 일반화하는 능력이 증가할 것을 기대할 수 있다. (bias-variance tradeoff에 대한 14장의 논의와 같이)

  10. 15.1 Support vector machines:The linearly separable case • SVM을 수식으로 정형화해 보자 • 14장(278page)에서 말했듯이, decision hyperplane은 intercept term b와 decision hyperplane의 normal vector w 로 정의될 수 있다. ( w 는 machine learning문헌에서 종종 weight vector로 언급된다) • normal vector w 에 수직인 모든 hyperplane중 하나를 선택하기 위해, intercept term b를 특정한다. • hyperplane은 normal vector와 수직이므로, hyperplane의 모든 벡터 x는 를 만족한다.

  11. 15.1 Support vector machines:The linearly separable case • training data의 집합 을 가지고 있다고 가정하고 • 두 데이터 클래스는 +1, -1으로 이름 붙인다. • intercept term은 에 합쳐서 넣지 않고, 외부로 떼어내어 b로 표현한다. (rather than being folded into the weight vector w by adding an extra always-on feature) • 이 경우, 선형분류기는, • 의 값이 1이 나오면 +1 클래스 의 값이 -1이 나오면 -1 클래스 로 분류된다.

  12. 15.1 Support vector machines:The linearly separable case • point를 분류하는데 있어, 결정면에서 멀리 떨어져 있는 point를 분류하는 것은 확신을 가질 수 있다. • 주어진 data set과 decision hyperplane에서 i번째 예 벡터의 hyperplane으로부터의functional margin을 정의하고 이것은값을 가진다.

  13. 15.1 Support vector machines:The linearly separable case • decision surface에 대한 data set의 functional margin은, minimal functional margin을 가지는 data set의 어떤 point보다 2배의 값을 가진다. The functional margin of a data set with respect to a decision surface is then twice the functional margin of any of the points in the data set with minimal functional margin (the factor of 2 comes from measuring across the whole width of the margin, as in Figure 15.3)

  14. 15.1 Support vector machines:The linearly separable case • decision surface에 대한 data set의 functional margin은, minimal functional margin을 가지는 data set의 어떤 point보다 2배의 값을 가진다. The functional margin of a data set with respect to a decision surface is then twice the functional margin of any of the points in the data set with minimal functional margin (the factor of 2 comes from measuring across the whole width of the margin, as in Figure 15.3)

  15. 15.1 Support vector machines:The linearly separable case • 앞의 Functional margin의 정의를 그대로 사용하기에는 문제가 있다. : The value is underconstrained. • w벡터와 b 에 임의의 수를 곱해줌으로서, functional margin을 마음대로 조절할 수 있다. ex> 를 로 하고, b를 5b로 하면 functional margin이 되어 5배가 된다 • w 벡터의 크기에 제약을 줄 필요가 있다. 이 말을 이해하기 위해, 실제 geometry를 살펴보자

  16. 15.1 Support vector machines:The linearly separable case • r : decision hyperplane과 간의 실제 거리 (Euclidean distance) • data point와 decision hyperplane간의 최단거리는 decision hyperplane에 수직이다. 따라서 에 평행하다. • 이 방향에서, 단위 벡터는 이다.

  17. 15.1 Support vector machines:The linearly separable case • 에 가장 가까운 decision hyperplane의 접점 부위를

  18. 15.1 Support vector machines:The linearly separable case • Geometric margin은 scaling of parameter에 따라 변하지 않는다. • functionalmargin은 마음대로 scaling할 수 있으므로, 큰 SVM문제 풀이의 편의를 위해, 모든 data point의 functional margin이 최소한 1 이상이 되도록 선택한다. 적어도 하나의 data point는 functional margin이 1이어야 한다. • Geometric margin

  19. 15.1 Support vector machines:The linearly separable case • SVM의 목표는 다음을 충족하는 와 b를 찾는 것이다. • 최대화 문제를 최소화 문제로 변형 • 선형 조건을 가진 2차 함수의 최적화 문제 : Quadratic Optimization problem

  20. 15.1 Support vector machines:The linearly separable case • Quadratic Optimization problem은 잘 알려진 수학적인 최적화 문제이며, 많은 solving algorithm이 존재한다. • Standard quadratic programming library를 이용해서 SVM을 만들 수도 있지만, 최근 이 부분에 많은 연구가 있어왔고, 그에 따라 보다 섬세하면서도 빠르고 확장 가능한 library들도 사용 가능하다. 이러한 알고리즘의 세부 사항에 대해서는 여기서 다루지 않겠다. • However, it will be helpful to what follows to understand the shape of the solution of such an optimization problem.

  21. 15.1 Support vector machines:The linearly separable case • Solution: • Lagrange multiplier 가 primal problem의 각 constraint 와 연관되어 있는 dual problem,을구성한다.

  22. 15.1 Support vector machines:The linearly separable case

  23. 15.1 Support vector machines:The linearly separable case • 는 대부분 0의 값을 가진다. • xi가 supporting vector인 경우만 non-zero값을 가진다. • 최적화 문제 및 결정 함수에서, 두 point간의 내적 계산을 포함한다. - point를 사용해서 계산하는 유일한 방법

  24. 15.1 Support vector machines:The linearly separable case Overview • Training data set에서 시작 Data set은 특이적으로 best separating hyperplane을 정의함 • quadratic optimization procedure에 data를 줘서, 이 hyperplane을 찾아낸다. • 새로 분류할 data point가 주어지면 분류함수를 이용 계산을 수행한다. 분류함수 결과값의 부호가, data point의 class를 결정한다.

  25. 15.1 Support vector machines:The linearly separable case • 포인트가 분류기의 마진 (혹은 오분류를 피하기 위해, 사전에 임의로 정한 confidence threshold t) 내에 위치하는경우, 분류기는 “알 수 없음” 결과를 낼 수 있다. • 분류함수의 결과값은 probability of classification으로 변환될 수 있다. : 값을 Sigmoid로 변환하는 것이 일반적인 표준이다.(Platt 2000) • margin이 일정하기 때문에, 만약 모델이 다양한 소스로부터 얻은 차원을 가지고 있다면, 섬세한 rescaling이 요구될 수 있다. (However, this is not a problem if our documents (points) are on the unit hypersphere)

  26. 15.1 Support vector machines:The linearly separable case

  27. 15.1 Support vector machines:The linearly separable case Example 15.1 • Figure 15.4의 매우 작은 data set에서 SVM을 생성하는 것을 생각해본다. yi : x (x1, x2) • 1 : (2,3) • -1 : (1,1), (2,0)

  28. 15.1 Support vector machines:The linearly separable case Example 15.1 • Figure 15.4의 매우 작은 data set에서 SVM을 생성하는 것을 생각해본다. yi : x (x1, x2) • 1 : (2,3) • -1 : (1,1), (2,0) SVM decision boundary • y = x1 + 2x2 – 5.5

  29. 15.1 Support vector machines:The linearly separable case Example 15.1 • Figure 15.4의 매우 작은 data set에서 SVM을 생성하는 것을 생각해본다. yi : x (x1, x2) • 1 : (2,3) • -1 : (1,1), (2,0) SVM decision boundary • y = x1 + 2x2 – 5.5

  30. 15.2 Extensions to the SVM model 15.2.1 Soft margin classification • 텍스트 분류와 같이 high dimensional problem이 흔한 경우, 데이터가 linearly separable한 경우도 있지만, 일반적으로 그렇지 않은 경우가 대부분이다. 설사, 선형 분리 가능한 경우라도, 몇몇 특이한 noise document를 무시해서 데이터를 더 잘 분리할 수 있는 해법을 찾는 것이 낫다. • training data가 선형 분리 불가능한 경우, decision margin이 몇 개의 mistake를 만들 수 있도록 허용한다. • 그리고 오분류된 사례에는 >1 방정식의 margin 요구조건에서 얼마나 멀리 떨어져 있는 가에 대해 비용을 매긴다. • 여기에 이란 개념을 도입한다.

  31. 15.2.1 Soft margin classification • Slack variable의 개념을 포함하는 SVM optimization problem • 최적화 문제는 이제, 얼마나 margin을 두텁게 할 수 있는가 vs 이 margin을 허용하기 위해 얼마나 많은 점을 이동시켜야 하는가 간의 trade off이다. • 을 0보다 크게 함으로서,margin이 1보다 작은 값을 가질 수 있지만, 최소화 문제에서 그만큼 더 더해짐으로써, penalty를 받게 된다. • soft margin classifier는 margin에 대해 교환된 training error를 최소화한다. • Parameter C는 overfitting을 통제하기 위한 regularization term이다.

  32. 15.2.1 Soft margin classification • soft margin classification의 dual problem • dual problem의 답 • 의 값을 명시적으로 알 필요는 없다. (data point들과의 dot point로 할 수 있다)

  33. 15.2.1 Soft margin classification • 일반적으로, training data의 작은 일부분만이 support vector이다. • 하지만, linearly nonseparable하거나, small margin을 가지는 문제의 경우, 오분류된 데이터 포인트나 margin안에 있는 포인트는 0이 아닌 값을 가지게 될 것이다. 이러한 포인트 집합이 늘어날 수록, SVM의 testing time에 큰 지연을 가져온다.

  34. 15.2.1 Soft margin classification • 선형 SVM의 training 및 testing의 complexity는 Table 15.1에 나와있다. • SVM의 training time은 대부분 QP(Quadratic Programming)을 푸는 데 들어간다. 따라서, 풀이 방식에 따라 이론적 및 경험적 complexity는 다를 수 있다. • Kozlov(1979)에 의하면, QP를 푸는데 표준 시간은 data set 크기의 세제곱에 비례한다. • 최근 SVM의 연구는 이러한 복잡도를 줄이기 위해 노력했으며, approximate solution에 의해 만족스러운 결과를 내고 있다. • 표준적으로 실험적인 complexity는 정도 이다. • 하지만 전통적인 SVM의 superlinear training시간은, 매우 큰 dataset을 가지는 경우에는 SVM의 사용을 어렵거나 불가능하게 하고 있다.

  35. 15.2.1 Soft margin classification • training example의 숫자에 선형인 Alternative traditional SVM solution 알고리즘은, text와 같이 큰 가지 수의 feature를 가지는 경우에 확장이 어려워진다. • 하지만 cutting plane technique에 기반한 새로운 training algorithm은, running time을 training example의 수 및 nonzero feature의 수에 선형으로 가짐으로서, 희망적인 답을 내고 있다. • 그럼에도, quadratic optimization을 하는 실제 속도는, 단순히 term을 세기만 하는 Naïve Bayes model보다 매우 늦다. • svmalgorithm을 비선형 SVM으로 확장하는 경우, 표준적으로 training complexity가 factor 만큼 증가되어, 비실용적이다. • 실제로는, higher order feature를 직접 계산(materialize)해서 선형 SVM을 훈련시키는 것이 종종 더 저렴하다.

  36. 15.2.2 Multiclass support vector machines • SVM은 본래 two-class 분류기이다. SVM을 multi-class classification에 사용하는 전통적인 방법은 Section 14.5에 소개된 바 있다. • build |C| one-versus-rest classifier (one-versus-all classification) : class 개수 만큼의 분류기를 생성한 뒤, 테스트 데이터가 가장 큰 마진을 가지는 class를 선택한다. • build a set of one-versus-one classifiers : |C| ( |C| -1 ) / 2 분류기를 생성한 뒤, 가장 다수의 분류기에 의해 선택된 class를 선택 : 분류기 수는 많지만, 각 분류기 별 training set의 크기는 감소하므로, 실제 training시간은 더 적을 수 있다.

  37. 15.2.2 Multiclass support vector machines • 보다 나은 대안: Structural SVM • (input feature, 데이터의 class) 의쌍으로 구성된, feature vector 에 대하여 two-class classifier를 생성한다. margin during training : correct class의 값과 nearest other class의 값 간의 차이 constraint: • testing시에, 하는 분류기를 선택한다.

  38. 15.2.2 Multiclass support vector machines • 이러한 방법은, 다양한 선형 분류기의 multiclass formulation으로 확장될 수 있다. • 이것은 또한, class가 독립적인, categorical label이 아닌, 그들 사이의 관계를 가지고 있는 임의의 구조화된 객체들 에 대한 분류의 일반화이다.

  39. 15.2.3 Nonlinear support vector machines

  40. 15.2.3 Nonlinear support vector machines • General idea : 원래 feature space를, training set이 분리 가능한 higher dimensional feature space로 mapping • SVM과 몇몇 선형 분류기들은, higher dimensional space로 mapping을 수행하는 데 있어, kernel trick이라 불리는 쉽고 효율적인 방법을 제공한다. • 커넬 함수 K는, 확장된 feature space에서 doc product에 해당하는 함수이다.

  41. 15.2.3 Nonlinear support vector machines

  42. 15.2.3 Nonlinear support vector machines • 기능적으로 분석할 때(In the language of functional analysis), 어떤 커넬 함수가 유효한(valid) 커넬 함수인가? • 커넬함수는, Mercer’s condition을 만족해야 하므로, 보다 정확히는 Mercer kernels라고 불리운다. • 커넬 함수 K는 연속적이고(continuous), 대칭적이며(symmetric), positive-definite gram matrix를 가져야 한다. • 그러한 K는, 함수 K와 같은 값을 가지는 doc product가 있는,reproducing Hilbert space로의 mapping이 존재한다는 것을 의미한다.

  43. 15.2.3 Nonlinear support vector machines • 커넬이Mercer’s condition을 만족하지 못하면, Quadratic Programming은 해답이 없을 수 있다. • 이러한 Issue들에 대해 더 잘 이해하고자 한다면, References의 SVM관련 서적을 참고하라. • 그렇지 않다면, 이 사실에 안도해도 된다. 커넬과 관련된 일의 90%는, 다음에 소개할 두 가지 함수를 사용한다. • 가장 흔히 사용되는 두 가지 커넬은, Polynomial kernel과 radial basis function이다.

  44. 15.2.3 Nonlinear support vector machines Polynomial Kernel • d = 1 인 경우, linear kernel • d = 2 인 경우, quadratic kernel

  45. 15.2.3 Nonlinear support vector machines Radial basis function 가운데 가장 흔한 형태는, Gaussian distribution이다. • radial basis function은, 무한 차원의 Hilbert space로 data를 mapping하는 것과 동일(equivalent)하다. 그래서 radial basis function을 구체적으로 표현하는 것은 불가능하다. • 이 두 함수 외에도, 커넬 개발과 관련해 흥미 있는 연구들이 있었으며, 일부는 텍스트 영역에 유망한 것이다. 그 중에서도 특히,string kernel에 대한 연구가 있었다.

  46. 15.2.3 Nonlinear support vector machines • SVM의세계는 자신만의 언어를 가지고 있으며, 다른 machine learning 분야의 언어와 다른 부분이 있다. • Terminology의 깊은 뿌리는 수학에 두고 있다. • 하지만 terminology 때문에 지나치게 두려워 하지 않는 것이 중요하다.

More Related