728x90 반응형 kernel trick2 [Machine Learning] SVM in Python (2) - Margin, Regularization, Non-linear SVM, Kernel Predefined visualization function간단한 시각화를 위한 함수를 정의했다.def plot_svc_decision_boundary(svm_clf, xmin, xmax): w = svm_clf.coef_[0] b = svm_clf.intercept_[0] # At the decision boundary, w0*x0 + w1*x1 + b = 0 # => x1 = -w0/w1 * x0 - b/w1 x0 = np.linspace(xmin, xmax, 200) decision_boundary = -w[0]/w[1] * x0 - b/w[1] margin = 1/w[1] gutter_up = decision_boundary + margin gutt.. 2023. 5. 11. [Machine Learning] SVM (Support Vector Machine) Intuition아래 2차원 평면에 두 개의 클래스(초록색과 흰색)이 있고, 이를 분류하는 가상의 초평면(2차원이므로 여기서는 직선)을 생각해보자. $B_1$과 $B_2$ 두 직선 모두 두 클래스를 완벽히 구분할 수 있다. 그렇다면 어떤 직선(고차원의 경우 초평면)이 더 좋은 것일까?직관적으로 우리는 $B_1$이 더 좋은 직선임을 알 수 있다. 그 이유는 각 클래스와의 거리가 가장 멀기 때문이다. support vector: hyperplane과 가장 가까운 data pointmargin: hyperplane과 support vector와의 거리. 일반적으로 margin이 클수록 좋은 SVM이다. Note: hyperplane은 street로, margin은 street width로 많이 비유된다.SVM.. 2023. 5. 9. 이전 1 다음 728x90 반응형