- Notifications
You must be signed in to change notification settings - Fork34
Ruby language bindings for LIBSVM
License
BSD-3-Clause, MIT licenses found
Licenses found
febeling/rb-libsvm
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This package provides Ruby bindings to theLIBSVM library. SVMis a machine learning and classification algorithm, and LIBSVM is apopular free implementation of it, written by Chih-Chung Chang andChih-Jen Lin, of National Taiwan University, Taipei. See the book"ProgrammingCollective Intelligence," among others, for a usage example.
There is a JRuby implementation of this gem namedjrb-libsvm byAndreas Eger.
Note: There exist some other Ruby bindings for LIBSVM. One is namedRuby SVM, written by Rudi Cilibrasi. The other, moreactively developed one islibsvm-ruby-swig by Tom Zeng,which is built using SWIG.
LIBSVM includes a number of command line tools for preprocessingtraining data and finding parameters. These tools are not included inthis gem. You should install the original package if you need them.
It is helpful to consult theREADME of the LIBSVM package forreference when configuring the training parameters.
Currently this package includes libsvm version 3.24.
None. LIBSVM is bundled with the project. Just install and go!
For building this gem from source on OS X (which is the defaultpackaging) you will need to have Xcode installed, and from within Xcodeyou need to install the command line tools. Those contain the compilerwhich is necessary for the native code, and similar tools.
To install the gem run this command
gem install rb-libsvmThis is a short example of how to use the gem.
require'libsvm'# This library is namespaced.problem=Libsvm::Problem.newparameter=Libsvm::SvmParameter.newparameter.cache_size=1# in megabytesparameter.eps=0.001parameter.c=10examples=[[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. useBundler.require or use an environment that relies on it,like Rails), then you will need to specify rb-libsvm in the Gemfilelike this:
gem'rb-libsvm',require:'libsvm'
This is because the loadable name (libsvm) is different from thegem's name (rb-libsvm).
The process to make a release of the gem package to rubygems.org has anumber of steps.
- manually change the version in
lib/libsvm/version.rb - clean, build, and run tests successfully
- update code and documentation
- push
- sign intohttps://rubygems.org/
- save API token fromhttps://rubygems.org/profile/edit and store in
.gem/credentialsby runninggem signin - perform actual release:
bundle exec rake release
Written byC. Florian Ebeling.
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 underthe license in the file LIBSVM-LICENSE.
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/
About
Ruby language bindings for LIBSVM
Topics
Resources
License
BSD-3-Clause, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.