Code Monkey home page Code Monkey logo

custom-svm-kernel's Introduction

Improving Classification Performance of Support Vector Machines via Guided Custom Kernel Search

This work builds upon the Neural Architecture Search (NAS) technique to find a custom kernel function for the SVM over MNIST dataset.
An RNN controller emits a kernel function for SVM. The SVM with the emitted kernel function is trained over 1000 MNIST training samples and the accuracy over a seperate 500 validation samples is used as a reward signal for the RNN controller. The RNN controller is trained via the vanilla policy gradient algorithm.

The final discovered kernel function by the controller is :-

k(x,y) = ||min{sin(x*y), sin(<x,y>/gamma)}|| 

Here (x*y) denotes the elementise product, <x,y> denotes the dot product of vectors and the norm is L-1 norm. Also, gamma is a constant, that is equal to the number of features in the data(784 for MNIST).

The results below are the accuracy for the entire 10000 test samples of MNIST when the SVM is trained with diffferent kernel functions over 1000 training samples. Here 'linear', 'RBF', 'Sigmoid' are the existing common SVM kernel functions.

Kernel function Validation Acc. Test Acc.
Linear 89.0 87.96
RBF 86.4 82.76
Sigmoid 81.0 74.42
Discovered kernel 90.2 91.01

To train the RNN controller that learns the custom kernel function run -

python3 mnist_kernel_search.py

To evaluate the trained model uncomment the two lines here to restore your trained model and then run -

python3 mnist_kernel_test_final.py

Running mnist_kernel_test_final.py currently will show the results corresponding to the above discovered custom kernel function.

Even though the RNN controller has been trained to learn a kernel function that best fits the 1000 training samples, the discovered kernel function works better than the other kernel functions even when it is used to fit 2000 training samples. The below are the test accuracy results when the different kernel functions are used to train SVM over 2000 samples.

Kernel function Test Acc.
Linear 89.87
RBF 87.85
Sigmoid 84.94
Discovered kernel 93.12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.