LightTwinSVM: A Fast, Light-weight and Simple Implementation of TwinSVM Classifier

Support Vector Machine (SVM) is a popular and state-of-the-art classification algorithm.  Hence many packages and implementations of standard SVM can be found on the internet. However, there are some interesting extensions of SVM that has a slightly better prediction accuracy. Of these extensions, Twin Support Vector Machine (TSVM) has received more attention from scholars in the field of SVM research. Even I myself have published a classifier based on TSVM and KNN.

TSVM does classification using two non-parallel hyperplanes as opposed to a single hyperplane in standard SVM (To know more about TSVM, you can read this blog post.).  Unlike SVM, TSVM had almost no fast and simple implementation on the internet prior to 2018. So I decided to develop the LightTwinSVM program and share it with others for free.

This program was designed to help researchers, students, and practitioners do classification easily using TwinSVM classifier without worrying about details of implementation.

LightTwinSVM's UI
LightTwinSVM’s command line interface

The LightTwinSVM program is mostly written in Python and has the following features:

  • A simple console program for using TwinSVM classifier on your dataset of interest.
  • Fast optimization algorithm: The clipDCD algorithm was improved and implemented in C++ for solving optimization problems of TwinSVM.
  • Linear, RBF, and Rectangular kernel are supported.
  • Binary and Multi-class classification (One-vs-All & One-vs-One) are supported.
  • Its estimator is scikit-learn compatible so that sklearn’s methods such as GridSearchCV and cross_val_score can be used.
  • K-fold cross-validation is supported.
  • Training/Test split is supported.
  • It supports grid search over C and gamma parameters.
  • CSV and LIBSVM data files are supported.
  • Detailed classification result can be saved in a spreadsheet file.

With the above features, the LightTwinSVM covers most of the use cases and can be used for research, education or even commercial projects. You also might be interested in using this program for your own work. If so, you can get LightTwinSVM on GitHub. A readme file was created to help users install and use the program.

If you’ve used LightTwinSVM and like it, please give star its repository on GitHub.

Let me know your feedback and thoughts regarding the improvement of LightTwinSVM in the comments section below.

Leave a Reply

Your email address will not be published. Required fields are marked *