ProductPromotion
Logo

Ruby

made by https://0x3d.site

GitHub - febeling/rb-libsvm: Ruby language bindings for LIBSVM
Ruby language bindings for LIBSVM. Contribute to febeling/rb-libsvm development by creating an account on GitHub.
Visit Site

GitHub - febeling/rb-libsvm: Ruby language bindings for LIBSVM

GitHub - febeling/rb-libsvm: Ruby language bindings for LIBSVM

Gem Version

rb-libsvm -- Ruby language bindings for LIBSVM

This package provides Ruby bindings to the LIBSVM library. SVM is a machine learning and classification algorithm, and LIBSVM is a popular free implementation of it, written by Chih-Chung Chang and Chih-Jen Lin, of National Taiwan University, Taipei. See the book "Programming Collective Intelligence," among others, for a usage example.

There is a JRuby implementation of this gem named jrb-libsvm by Andreas Eger.

Note: There exist some other Ruby bindings for LIBSVM. One is named Ruby SVM, written by Rudi Cilibrasi. The other, more actively developed one is libsvm-ruby-swig by Tom Zeng, which is built using SWIG.

LIBSVM includes a number of command line tools for preprocessing training data and finding parameters. These tools are not included in this gem. You should install the original package if you need them.

It is helpful to consult the README of the LIBSVM package for reference when configuring the training parameters.

Currently this package includes libsvm version 3.24.

Dependencies

None. LIBSVM is bundled with the project. Just install and go!

Installation

For building this gem from source on OS X (which is the default packaging) you will need to have Xcode installed, and from within Xcode you need to install the command line tools. Those contain the compiler which is necessary for the native code, and similar tools.

To install the gem run this command

gem install rb-libsvm

Usage

This is a short example of how to use the gem.

require 'libsvm'

# This library is namespaced.
problem = Libsvm::Problem.new
parameter = Libsvm::SvmParameter.new

parameter.cache_size = 1 # in megabytes

parameter.eps = 0.001
parameter.c = 10

examples = [ [1,0,1], [-1,0,-1] ].map {|ary| Libsvm::Node.features(ary) }
labels = [1, -1]

problem.set_examples(labels, examples)

model = Libsvm::Model.train(problem, parameter)

pred = model.predict(Libsvm::Node.features(1, 1, 1))
puts "Example [1, 1, 1] - Predicted #{pred}"

If you want to rely on Bundler for loading dependencies in a project, (i.e. use Bundler.require or use an environment that relies on it, like Rails), then you will need to specify rb-libsvm in the Gemfile like this:

gem 'rb-libsvm', require: 'libsvm'

This is because the loadable name (libsvm) is different from the gem's name (rb-libsvm).

Release

The process to make a release of the gem package to rubygems.org has a number of steps.

  • manually change the version in lib/libsvm/version.rb
  • clean, build, and run tests successfully
  • update code and documentation
  • push
  • sign into https://rubygems.org/
  • save API token from https://rubygems.org/profile/edit and store in .gem/credentials by running gem signin
  • perform actual release: bundle exec rake release

Author

Written by C. Florian Ebeling.

Contributors

License

This software can be freely used under the terms of the MIT license, see file MIT-LICENSE.

This package includes the source of LIBSVM, which is free to use under the license in the file LIBSVM-LICENSE.

Posts about using SVMs with Ruby

https://www.practicalai.io/implementing-classification-using-a-svm-in-ruby/

http://neovintage.blogspot.com/2011/11/text-classification-using-support.html

http://www.igvita.com/2008/01/07/support-vector-machines-svm-in-ruby/

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory