Skip to content

    Support Vector Machine

    Machine Learning · Advanced

    Definition

    An SVM finds the boundary that separates classes with the maximum margin.

    Effective in high-dimensional spaces; kernels handle non-linear data.

    Diagram

    class A ●●| margin |class B ○○

    Flowchart

    Plot dataFind separating hyperplaneMaximize margin to support vectorsUse kernel if not linear

    Example: Decision rule

    w, b = [1, -1], 0
    for x in [(3, 1), (1, 3)]:
        s = w[0]*x[0] + w[1]*x[1] + b
        print(x, 'A' if s > 0 else 'B')

    Output: (3, 1) A (1, 3) B

    Complexity

    Training roughly O(n²)–O(n³)

    Key points

    • C controls margin vs errors
    • RBF kernel is a common default

    Interview questions

    What are support vectors?

    Training points closest to the boundary that define the margin.

    More Machine Learning topics