Giter VIP home page Giter VIP logo

libsvm-ruby-swig's Introduction

libsvm-ruby-swig

  • Ruby interface to LIBSVM (using SWIG)

THIS FORK:

Only supports i368 on Mac OS 10.5 (Leopard), which we did to meet our immediate development needs. As you might expect, the “ext/Makefile” explicitly specifies both the architecture (e.g. “-arch i368”) and the path to the Ruby headers.

Snow Leopard (10.6) has not been tested, but we’ll test and support it when we move our development stack to Snow Leopard. If you really want build for Snow Leopard, try setting “-arch x86_64” in the “ext/Makefile” if you want a 64-bit build for Snow Leopard, and setting the RUBY_INCLUDEDIR in your env (or manually changing the default value in the “ext/Makefile”).

In tomz’s fork, the Makefile is generated via the extconf.rb. We were unable to get a usable Makefile using extconf.rb on Mac OS X Leopard, so we’re using our own, non-generated Makefile. Someone with better mkmf skills could get it working and support most/all targets in the process.

DESCRIPTION:

Mac OS 10.5 and i386 only Ruby port of the LIBSVM Python SWIG (Simplified Wrapper and Interface Generator) interface.

A slightly modified version of LIBSVM 2.89 is included, it allows turning on/off the debug log. You don’t need your own copy of SWIG to use this library - all needed files are generated using SWIG already.

Look for the README file in the ruby subdirectory for instructions. The binaries included were built under Ubuntu Linux 2.6.24-23-generic, you should run make under the libsvm-2.89 and libsvm-2.89/ruby directories to regenerate the executables for your environment.

LIBSVM is in use at tweetsentiments.com - A Twitter / Tweet sentiment analysis application

INSTALL:

sudo gem sources -a http://gems.github.com   (you only have to do this once)
sudo gem install plastictrophy-libsvm-ruby-swig

See github.com/tomz/libsvm-ruby-swig for Linux support.

SYNOPSIS:

Quick Interactive Tutorial using irb (adopted from the python code from Toby Segaran’s “Programming Collective Intelligence” book):

irb(main):001:0> require 'svm'
=> true
irb(main):002:0> prob = Problem.new([1,-1],[[1,0,1],[-1,0,-1]])
irb(main):003:0> param = Parameter.new(:kernel_type => LINEAR, :C => 10)
irb(main):004:0> m = Model.new(prob,param)
irb(main):005:0> m.predict([1,1,1])
=> 1.0
irb(main):006:0> m.predict([0,0,1])
=> 1.0
irb(main):007:0> m.predict([0,0,-1])
=> -1.0
irb(main):008:0> m.save("test.model")
irb(main):009:0> m2 = Model.new("test.model")
irb(main):010:0> m2.predict([0,0,-1])
=> -1.0

AUTHOR:

Tom Zeng

Mariano Lizarraga and Galen O’Hanlon

libsvm-ruby-swig's People

Contributors

tomz avatar gohanlon avatar malife avatar danielsdeleo avatar rkabir avatar

Stargazers

 avatar

Watchers

 avatar Brian Dunagan avatar Alvin Liang 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.