Skip to content

rahulor/svm-geom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOI

Support vector machine algorithm for separable data using elementary geometry

svm

Motivation

An iterative algorithm that makes use of elementary geometry to find the maximal margin hyperplane between two classes.

  • provides weight and bias that defines the optimum-hyperplane and also gives the support vectors.
  • applicable only for linearly separable problem. i.e., not suitable for soft-marging classification
  • if the data is not separable, the algorithm quickly figure out this and stops further iterations.
  • currently support binary classification of labelled data with number of features greater than 1.

Usage

from gsvm.classifier import GeometricClassifier
clf = GeometricClassifier()
clf.fit(X, label)

X is a multi-dimensional array where rows indicating samples and columns indicating features. Each row (sample) is associated with a class-label. label can be either a list (of str, number, or bool) or an array with size equal to the number of rows in X.

Optimal hyperplane (if exist) is uniquely determned by <weight, x> + bias = 0, where <,> denotes the scalar product and x is an arbitrary vector.

Useful attributes:

clf.coef_             # weight
clf.intercept_        # bias
clf.support_vectors_  # support vectors  i.e., x satisfying  <weight, x> + bias = 1 or -1
clf.support_          # indices of the support vectors in X
clf.width_            # width of the margin
clf.message           # string message indicating success or failure of the computation.
clf.success           # bool (True or False) indicating success or failure of the computation.

Sample output

About

fast iterative support vector machine algorithm for linearly separable dataset. Makes use of elementary geometry; no quadratic programming,

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages