SVM (Support Vector Machine) Algorithm

What is SVM?

SVM (Support Vector Machine) is a supervised machine learning algorithm that finds the optimal hyperplane to separate different classes. It maximizes the margin between the closest points of different classes (support vectors).

How It Works

  1. Map Data: Transform data to higher-dimensional space if needed
  2. Find Hyperplane: Identify the boundary that best separates classes
  3. Maximize Margin: Optimize for largest gap between classes
  4. Support Vectors: Points closest to the boundary determine it

Key Concepts

Kernel Trick

Allows SVM to handle non-linear relationships:
- Linear: For linearly separable data
- RBF (Radial Basis Function): Most common non-linear kernel
- Polynomial: For polynomial relationships
- Sigmoid: Similar to neural network activation

C Parameter (Regularization)

  • Low C: Wider margin, more misclassifications allowed
  • High C: Narrower margin, fewer misclassifications

Advantages

  • Effective in High Dimensions: Works well with many features
  • Memory Efficient: Uses only support vectors
  • Versatile: Different kernels for different problems
  • Robust: Works well with clear margin of separation

Disadvantages

  • Slow on Large Datasets: Doesn't scale well
  • Sensitive to Features: Requires feature scaling
  • No Probability: Doesn't directly output probabilities
  • Kernel Selection: Choosing the right kernel is important

Related Terms

  • Kernel: Function to transform data
  • Classification: SVM's primary use case
  • Feature Selection: Often used with SVM