rb-libsvm 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -9,3 +9,4 @@ Gemfile*
9
9
  tags
10
10
  *.swp
11
11
  *~
12
+ /.rbx/
data/.travis.yml CHANGED
@@ -2,3 +2,5 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ - rbx-18mode
6
+ - rbx-19mode
data/README.md CHANGED
@@ -2,22 +2,22 @@
2
2
 
3
3
  Spec Status: [![Build Status](https://secure.travis-ci.org/febeling/rb-libsvm.png)](http://travis-ci.org/febeling/rb-libsvm)
4
4
 
5
- This is a module which provides a Ruby API to the LIBSVM [1] library.
6
- SVM is a machine learning and classification algorithm, and LIBSVM is
7
- a popular free implementation of it, written by Chih-Chung Chang and
5
+ This package provides a Ruby bindings to the LIBSVM [1] library. SVM
6
+ is a machine learning and classification algorithm, and LIBSVM is a
7
+ popular free implementation of it, written by Chih-Chung Chang and
8
8
  Chih-Jen Lin, of National Taiwan University, Taipei. See "Programming
9
9
  Collective Intelligence," [2] among others, for a usage example.
10
10
 
11
- Note: There exists another Ruby binding for LIBSVM, named Ruby SVM,
12
- [3] written by Rudi Cilibrasi. (That's the one mentioned in the
13
- libsvm documentation.) This package is not related but written
14
- independently and from scratch.
11
+ Note: There exist two other Ruby bindings for LIBSVM. One is named
12
+ Ruby SVM, written by Rudi Cilibrasi. It is hard to find now. The
13
+ other, more actively developed one is libsvm-ruby-swig by Tom Zeng
14
+ [3], which is built using SWIG.
15
15
 
16
16
  ## Dependencies
17
17
 
18
18
  None. Libsvm is bundled with the project. Just install and go!
19
19
 
20
- Currently using libsvm version 3.12
20
+ Currently includes libsvm version 3.12.
21
21
 
22
22
  ## Installation
23
23
 
@@ -25,27 +25,28 @@ Currently using libsvm version 3.12
25
25
 
26
26
  ## Usage
27
27
 
28
- require 'libsvm'
28
+ ```ruby
29
+ require 'libsvm'
29
30
 
30
- # This library is namespaced.
31
- problem = Libsvm::Problem.new
32
- parameter = Libsvm::SvmParameter.new
31
+ # This library is namespaced.
32
+ problem = Libsvm::Problem.new
33
+ parameter = Libsvm::SvmParameter.new
33
34
 
34
- parameter.cache_size = 1 # in megabytes
35
+ parameter.cache_size = 1 # in megabytes
35
36
 
36
- parameter.eps = 0.001
37
- parameter.c = 10
37
+ parameter.eps = 0.001
38
+ parameter.c = 10
38
39
 
39
- examples = [ [1,0,1], [-1,0,-1] ].map {|ary| Libsvm::Node.features(ary) }
40
- labels = [1, -1]
40
+ examples = [ [1,0,1], [-1,0,-1] ].map {|ary| Libsvm::Node.features(ary) }
41
+ labels = [1, -1]
41
42
 
42
- problem.set_examples(labels, examples)
43
+ problem.set_examples(labels, examples)
43
44
 
44
- model = Libsvm::Model.train(problem, parameter)
45
-
46
- pred = model.predict(Libsvm::Node.features(1, 1, 1))
47
- puts "Example [1, 1, 1] - Predicted #{pred}"
45
+ model = Libsvm::Model.train(problem, parameter)
48
46
 
47
+ pred = model.predict(Libsvm::Node.features(1, 1, 1))
48
+ puts "Example [1, 1, 1] - Predicted #{pred}"
49
+ ```
49
50
 
50
51
  ## Author, License
51
52
 
@@ -68,8 +69,9 @@ the license in the file LIBSVM-LICENSE.
68
69
  [http://www.igvita.com/2008/01/07/support-vector-machines-svm-in-ruby/](http://www.igvita.com/2008/01/07/support-vector-machines-svm-in-ruby/)
69
70
 
70
71
 
71
- ### Notes
72
72
 
73
- [http://www.csie.ntu.edu.tw/~cjlin/libsvm/](http://www.csie.ntu.edu.tw/~cjlin/libsvm/)
73
+ [1]: [http://www.csie.ntu.edu.tw/~cjlin/libsvm/](http://www.csie.ntu.edu.tw/~cjlin/libsvm/)
74
+
75
+ [2]: [http://books.google.com/books?id=fEsZ3Ey-Hq4C](http://books.google.com/books?id=fEsZ3Ey-Hq4C)
74
76
 
75
- [http://books.google.com/books?id=fEsZ3Ey-Hq4C](http://books.google.com/books?id=fEsZ3Ey-Hq4C)
77
+ [3]: http://github.com/tomz/libsvm-ruby-swig/tree/master
data/Rakefile CHANGED
@@ -4,12 +4,11 @@ require 'rspec/core/rake_task'
4
4
 
5
5
  task :default => :spec
6
6
 
7
- Rake::ExtensionTask.new('rb-libsvm') do |ext|
8
- ext.lib_dir = File.join('lib', 'rb-libsvm')
9
- ext.name = 'libsvm'
7
+ Rake::ExtensionTask.new('libsvm') do |ext|
8
+ ext.lib_dir = File.join('lib', 'libsvm')
9
+ ext.name = 'libsvm_ext'
10
10
  end
11
11
 
12
12
  RSpec::Core::RakeTask.new('spec')
13
13
  Rake::Task[:spec].prerequisites << :clean
14
14
  Rake::Task[:spec].prerequisites << :compile
15
-
@@ -6,6 +6,6 @@ $LDFLAGS << " -lstdc++ "
6
6
  HEADER_DIRS = []
7
7
  LIB_DIRS = []
8
8
 
9
- dir_config('rb-libsvm',HEADER_DIRS,LIB_DIRS)
9
+ dir_config('libsvm', HEADER_DIRS, LIB_DIRS)
10
10
 
11
- create_makefile('rb-libsvm/libsvm')
11
+ create_makefile('libsvm/libsvm_ext')
@@ -422,7 +422,7 @@ static VALUE cModel_class_cross_validation(VALUE cls, VALUE problem, VALUE param
422
422
  return target;
423
423
  }
424
424
 
425
- void Init_libsvm() {
425
+ void Init_libsvm_ext() {
426
426
  mLibsvm = rb_define_module("Libsvm");
427
427
 
428
428
  /* Libsvm::Problem */
File without changes
File without changes
File without changes
data/lib/libsvm.rb CHANGED
@@ -1,5 +1,5 @@
1
- require 'rb-libsvm/version'
2
- require 'rb-libsvm/libsvm'
1
+ require 'libsvm/version'
2
+ require 'libsvm/libsvm_ext'
3
3
  require 'libsvm/node'
4
4
 
5
5
  module Libsvm
@@ -12,7 +12,6 @@ module Libsvm
12
12
  end
13
13
  end
14
14
 
15
-
16
15
  class Hash
17
16
  include Libsvm::CoreExtensions::Collection
18
17
  end
@@ -0,0 +1,3 @@
1
+ module Libsvm
2
+ VERSION = "1.0.8"
3
+ end
data/rb-libsvm.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require 'rb-libsvm/version'
3
+ require 'libsvm/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "rb-libsvm"
@@ -22,6 +22,5 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency('rake-compiler')
23
23
  s.add_development_dependency('rspec', '>= 2.7.0')
24
24
 
25
- s.extensions << 'ext/rb-libsvm/extconf.rb'
25
+ s.extensions << 'ext/libsvm/extconf.rb'
26
26
  end
27
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-libsvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-12 00:00:00.000000000Z
13
+ date: 2012-07-02 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake-compiler
17
- requirement: &70308564367400 !ruby/object:Gem::Requirement
17
+ requirement: &70133955492220 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70308564367400
25
+ version_requirements: *70133955492220
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &70308564365620 !ruby/object:Gem::Requirement
28
+ requirement: &70133955490320 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,14 +33,14 @@ dependencies:
33
33
  version: 2.7.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70308564365620
36
+ version_requirements: *70133955490320
37
37
  description: libsvm and ruby without using swig
38
38
  email:
39
39
  - florian.ebeling@gmail.com
40
40
  - neovintage@gmail.com
41
41
  executables: []
42
42
  extensions:
43
- - ext/rb-libsvm/extconf.rb
43
+ - ext/libsvm/extconf.rb
44
44
  extra_rdoc_files: []
45
45
  files:
46
46
  - .gitignore
@@ -53,14 +53,14 @@ files:
53
53
  - Rakefile
54
54
  - examples/text.rb
55
55
  - examples/toy.rb
56
- - ext/rb-libsvm/extconf.rb
57
- - ext/rb-libsvm/libsvm.c
58
- - ext/rb-libsvm/ruby-ext.h
59
- - ext/rb-libsvm/svm.cpp
60
- - ext/rb-libsvm/svm.h
56
+ - ext/libsvm/extconf.rb
57
+ - ext/libsvm/libsvm.c
58
+ - ext/libsvm/ruby-ext.h
59
+ - ext/libsvm/svm.cpp
60
+ - ext/libsvm/svm.h
61
61
  - lib/libsvm.rb
62
62
  - lib/libsvm/node.rb
63
- - lib/rb-libsvm/version.rb
63
+ - lib/libsvm/version.rb
64
64
  - rb-libsvm.gemspec
65
65
  - spec/model_spec.rb
66
66
  - spec/node_spec.rb
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  segments:
84
84
  - 0
85
- hash: -321019146793040831
85
+ hash: 1508460701576130505
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  none: false
88
88
  requirements:
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: -321019146793040831
94
+ hash: 1508460701576130505
95
95
  requirements: []
96
96
  rubyforge_project: rb-libsvm
97
97
  rubygems_version: 1.8.10
@@ -1,3 +0,0 @@
1
- module Libsvm
2
- VERSION = "1.0.7"
3
- end