Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Support Vector Machine (svm) Classifier

Data

  1. We load training areas from data/training_areas_ml.geojson.

  2. Spectral band values (Green, Red, NIR) are simulated from class-specific reflectance profiles.

  3. The binary target is already encoded: ml_label = 1 (Corn/Maize) vs ml_label = 0 (Non-Corn).

  4. We normalize the features to [0, 1] and split into training and testing sets.

Function for decision boundaries

Next, we are going to define a function to plot the decision boundary.

SVM (Linear kernel)

Procedure

First, We will initialize and train a SVM linear kernel classifier.

SVM (Polynomial kernel)

Polynomial kernel maps the input space to a higher-degree polynomial feature space. Useful when the relationship between features is non-linear.

Formula:

K(x,y)=(xTy+c)dK(x, y) = (x^T y + c)^d

where d is the degree of the polynomial and c is a free parameter.

SVM (RBF kernel)

Radial basis function (RBF) kernel computes similarity between two points using a Gaussian function.

K(xi,xj)=exp⁡(−∥xi−xj∥22σ2)K(x_i, x_j) = \exp\left(-\frac{\|x_i - x_j\|^2}{2\sigma^2}\right)

SVM (Sigmoid Kernel)

  • Sigmoid Kernel acts similar to a neuron in a neural network.

K(x,y)=tanh⁡(αxTy+c)K(x, y) = \tanh(\alpha x^T y + c)

👩🏽‍💻 TEST IT OUT

How about if we want to check for 5 classes? Try it out with training_areas.geojson.