Sure! Let's dive into each of these topics with clear explanations and examples.
1. Hyperplane
Definition:
A hyperplane is a decision boundary that separates different classes in feature space. In linear classification, it is represented by the equation ( wx + b = 0 ), where ( w ) is the weight vector, ( x ) is the feature vector, and ( b ) is the bias term.
Example:
- In 2D space, a hyperplane is a line.
- In 3D space, a hyperplane is a plane.
2. Support Vectors
Definition:
Support vectors are the data points that are closest to the hyperplane. They are crucial for determining the position and orientation of the hyperplane and the margin in SVM.
Example:
- In a 2D plot, these are the points that lie on the dashed lines parallel to the decision boundary (hyperplane).
3. Margin
Definition:
The margin is the distance between the hyperplane and the support vectors. SVM aims to maximize this margin to achieve better classification performance.
Example:
- If the hyperplane is ( y = 2x + 3 ) and the support vectors are at ( (1, 5) ) and ( (2, 7) ), the margin is the perpendicular distance between these points and the hyperplane.
4. Kernel
Definition:
A kernel is a function that maps data to a higher-dimensional space, enabling SVM to handle non-linearly separable data.
Common Kernels:
- Linear Kernel: ( K(x, x') = x \cdot x' )
- Polynomial Kernel: ( K(x, x') = (x \cdot x' + c)^d )
- Radial Basis Function (RBF) Kernel: ( K(x, x') = \exp(-\gamma |x - x'|^2) )
Example:
- Using an RBF kernel can transform non-linearly separable data into a space where it becomes linearly separable.
5. Hard Margin
Definition:
A hard margin is a maximum-margin hyperplane that perfectly separates the data without any misclassifications.
Example:
- If your data is perfectly linearly separable, a hard margin SVM will find a hyperplane that separates the classes without any errors.
6. Soft Margin
Definition:
A soft margin allows some misclassifications by introducing slack variables, balancing margin maximization and misclassification penalties when data is not perfectly separable.