Code Monkey home page Code Monkey logo

svm-geom's Introduction

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

svm-geom's People

Contributors

rahulor avatar

Watchers

 avatar

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.