Support Vector Machines (SVMs) - Simple Example

Steve Clarke

2020-02-27

Problem and Data

Simple classification problem dataset. What is the animal based on number of legs, segments and wings.

Legs and Segments (2D)

Utalising only the legs and segments data a simple scatter plot can be produced.

As we can see Ant and Bee have the same data, this makes classification for these two impossible without further data. Lets try fitting a SVM to predict the animal names based on the two vairables.

We can then use the model to predict classifications. Giving back the original table, results in the same answers apart from Ant. This is due to them having the same classification data (2 legs, 3 segments)

Like normal regression fitting (line of best fit), different equations can be used for the vectors of the areas made.

Legs, Segments and Wings (3D)

By adding in an additional variable, classify Ants and Bees becomes possible. Looking at 3D Scatters it is possible to see all animals are now in distinct space each.

Fitting a SVM to the three variables and testing the prediction. Note this cannot be plotted.

Now we have added wings the model correctly distingishes between Ants and Bees. Obviously this is a simple example which can be visualised. Complex versions can have 100’s if not 1000’s of cariables.