vowpalwabbit 0.1.1 → 0.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -2
- data/LICENSE.txt +26 -18
- data/README.md +26 -13
- data/lib/vowpalwabbit/classifier.rb +1 -1
- data/lib/vowpalwabbit/model.rb +13 -6
- data/lib/vowpalwabbit/version.rb +1 -1
- data/lib/vowpalwabbit.rb +1 -1
- metadata +12 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dd1b21080c412dc2e9571f7728cd71396f203e85fbc8790b8993ba01414a14d
|
4
|
+
data.tar.gz: 5435815694fa67e2659b72cbc3ceef6c928b89f4f5975754e981899d443f3928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c0b2950c6ef4f6b185a26198e540f647dc643d0f8e95f751b21cd4d6a157a0ba6216be710d2efb1cf715c74832121c18fcc655ca4462263ff03d1a7bcb02c64
|
7
|
+
data.tar.gz: 54681fcfe2e715576193317949c8e5c78a0e610026fd52e2547eab4873b4966f61b0fa0ae3822445d24248e0e89ef655e9ad7507da2b722862c59336ae028f6f
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.2.0 (2022-09-02)
|
2
|
+
|
3
|
+
- Prefer `save` over `save_model`
|
4
|
+
- Prefer `load` over `load_model`
|
5
|
+
- Dropped support for Ruby < 2.7
|
6
|
+
|
7
|
+
## 0.1.3 (2022-02-02)
|
8
|
+
|
9
|
+
- Added support for Ubuntu package
|
10
|
+
|
11
|
+
## 0.1.2 (2020-08-18)
|
12
|
+
|
13
|
+
- Changed to BSD 3-Clause license to match Vowpal Wabbit
|
14
|
+
- Fixed deprecation warning in Ruby 2.7
|
15
|
+
|
16
|
+
## 0.1.1 (2019-11-02)
|
2
17
|
|
3
18
|
- Added support for compressed files
|
4
19
|
- Added support for Numo
|
5
20
|
|
6
|
-
## 0.1.0
|
21
|
+
## 0.1.0 (2019-10-21)
|
7
22
|
|
8
23
|
- First release
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,30 @@
|
|
1
|
-
|
1
|
+
BSD 3-Clause License
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) Microsoft Corp 2012-2014, Yahoo! Inc. 2007-2012, and many individual contributors
|
4
|
+
Copyright (c) 2019-2021, Andrew Kane
|
5
|
+
All rights reserved.
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
8
|
+
modification, are permitted provided that the following conditions are met:
|
12
9
|
|
13
|
-
|
14
|
-
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
11
|
+
list of conditions and the following disclaimer.
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
14
|
+
this list of conditions and the following disclaimer in the documentation
|
15
|
+
and/or other materials provided with the distribution.
|
16
|
+
|
17
|
+
3. Neither the name of the copyright holder nor the names of its
|
18
|
+
contributors may be used to endorse or promote products derived from
|
19
|
+
this software without specific prior written permission.
|
20
|
+
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
25
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
26
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
28
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
29
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
# Vowpal Wabbit
|
1
|
+
# Vowpal Wabbit Ruby
|
2
2
|
|
3
3
|
[Vowpal Wabbit](https://vowpalwabbit.org) - fast online machine learning - for Ruby
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
[](https://travis-ci.org/ankane/vowpalwabbit)
|
5
|
+
[](https://github.com/ankane/vowpalwabbit-ruby/actions)
|
8
6
|
|
9
7
|
## Installation
|
10
8
|
|
@@ -14,10 +12,16 @@ First, install the [Vowpal Wabbit C++ library](https://vowpalwabbit.org/start.ht
|
|
14
12
|
brew install vowpal-wabbit
|
15
13
|
```
|
16
14
|
|
17
|
-
|
15
|
+
And for Ubuntu, use:
|
16
|
+
|
17
|
+
```sh
|
18
|
+
sudo apt install libvw0
|
19
|
+
```
|
20
|
+
|
21
|
+
Then add this line to your application’s Gemfile:
|
18
22
|
|
19
23
|
```ruby
|
20
|
-
gem
|
24
|
+
gem "vowpalwabbit"
|
21
25
|
```
|
22
26
|
|
23
27
|
## Getting Started
|
@@ -47,13 +51,13 @@ model.predict(x)
|
|
47
51
|
Save the model to a file
|
48
52
|
|
49
53
|
```ruby
|
50
|
-
model.
|
54
|
+
model.save("model.bin")
|
51
55
|
```
|
52
56
|
|
53
57
|
Load the model from a file
|
54
58
|
|
55
59
|
```ruby
|
56
|
-
model.
|
60
|
+
model = VowpalWabbit::Regressor.load("model.bin")
|
57
61
|
```
|
58
62
|
|
59
63
|
Train online
|
@@ -93,10 +97,10 @@ Data can be an array of arrays
|
|
93
97
|
[[1, 2, 3], [4, 5, 6]]
|
94
98
|
```
|
95
99
|
|
96
|
-
Or a Numo
|
100
|
+
Or a Numo array
|
97
101
|
|
98
102
|
```ruby
|
99
|
-
Numo::
|
103
|
+
Numo::NArray.cast([[1, 2, 3], [4, 5, 6]])
|
100
104
|
```
|
101
105
|
|
102
106
|
Or an array of strings
|
@@ -128,13 +132,22 @@ Read more about the [input format](https://github.com/VowpalWabbit/vowpal_wabbit
|
|
128
132
|
|
129
133
|
## History
|
130
134
|
|
131
|
-
View the [changelog](https://github.com/ankane/vowpalwabbit/blob/master/CHANGELOG.md)
|
135
|
+
View the [changelog](https://github.com/ankane/vowpalwabbit-ruby/blob/master/CHANGELOG.md)
|
132
136
|
|
133
137
|
## Contributing
|
134
138
|
|
135
139
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
136
140
|
|
137
|
-
- [Report bugs](https://github.com/ankane/vowpalwabbit/issues)
|
138
|
-
- Fix bugs and [submit pull requests](https://github.com/ankane/vowpalwabbit/pulls)
|
141
|
+
- [Report bugs](https://github.com/ankane/vowpalwabbit-ruby/issues)
|
142
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/vowpalwabbit-ruby/pulls)
|
139
143
|
- Write, clarify, or fix documentation
|
140
144
|
- Suggest or add new features
|
145
|
+
|
146
|
+
To get started with development:
|
147
|
+
|
148
|
+
```sh
|
149
|
+
git clone https://github.com/ankane/vowpalwabbit-ruby.git
|
150
|
+
cd vowpalwabbit-ruby
|
151
|
+
bundle install
|
152
|
+
bundle exec rake test
|
153
|
+
```
|
data/lib/vowpalwabbit/model.rb
CHANGED
@@ -46,6 +46,7 @@ module VowpalWabbit
|
|
46
46
|
File.binwrite(filename, bin_str)
|
47
47
|
nil
|
48
48
|
end
|
49
|
+
alias_method :save, :save_model
|
49
50
|
|
50
51
|
def load_model(filename)
|
51
52
|
bin_str = File.binread(filename)
|
@@ -55,6 +56,12 @@ module VowpalWabbit
|
|
55
56
|
nil
|
56
57
|
end
|
57
58
|
|
59
|
+
def self.load(filename)
|
60
|
+
model = new
|
61
|
+
model.load_model(filename)
|
62
|
+
model
|
63
|
+
end
|
64
|
+
|
58
65
|
private
|
59
66
|
|
60
67
|
# TODO clean-up handle
|
@@ -64,21 +71,21 @@ module VowpalWabbit
|
|
64
71
|
|
65
72
|
def param_str(params)
|
66
73
|
args =
|
67
|
-
params.
|
74
|
+
params.flat_map do |k, v|
|
68
75
|
check_param(k.to_s)
|
69
76
|
check_param(v.to_s)
|
70
77
|
|
71
78
|
if v == true
|
72
|
-
"--#{k}"
|
79
|
+
["--#{k}"]
|
73
80
|
elsif !v
|
74
|
-
|
81
|
+
[]
|
75
82
|
elsif k.size == 1
|
76
|
-
"-#{k}
|
83
|
+
["-#{k}", v]
|
77
84
|
else
|
78
|
-
"--#{k}
|
85
|
+
["--#{k}", v]
|
79
86
|
end
|
80
87
|
end
|
81
|
-
args.
|
88
|
+
args.join(" ")
|
82
89
|
end
|
83
90
|
|
84
91
|
def check_param(v)
|
data/lib/vowpalwabbit/version.rb
CHANGED
data/lib/vowpalwabbit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vowpalwabbit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -24,64 +24,8 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
|
28
|
-
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '5'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '5'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: numo-narray
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
description:
|
84
|
-
email: andrew@chartkick.com
|
27
|
+
description:
|
28
|
+
email: andrew@ankane.org
|
85
29
|
executables: []
|
86
30
|
extensions: []
|
87
31
|
extra_rdoc_files: []
|
@@ -95,11 +39,11 @@ files:
|
|
95
39
|
- lib/vowpalwabbit/model.rb
|
96
40
|
- lib/vowpalwabbit/regressor.rb
|
97
41
|
- lib/vowpalwabbit/version.rb
|
98
|
-
homepage: https://github.com/ankane/vowpalwabbit
|
42
|
+
homepage: https://github.com/ankane/vowpalwabbit-ruby
|
99
43
|
licenses:
|
100
|
-
-
|
44
|
+
- BSD-3-Clause
|
101
45
|
metadata: {}
|
102
|
-
post_install_message:
|
46
|
+
post_install_message:
|
103
47
|
rdoc_options: []
|
104
48
|
require_paths:
|
105
49
|
- lib
|
@@ -107,15 +51,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
51
|
requirements:
|
108
52
|
- - ">="
|
109
53
|
- !ruby/object:Gem::Version
|
110
|
-
version: '2.
|
54
|
+
version: '2.7'
|
111
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
56
|
requirements:
|
113
57
|
- - ">="
|
114
58
|
- !ruby/object:Gem::Version
|
115
59
|
version: '0'
|
116
60
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
118
|
-
signing_key:
|
61
|
+
rubygems_version: 3.3.7
|
62
|
+
signing_key:
|
119
63
|
specification_version: 4
|
120
|
-
summary:
|
64
|
+
summary: Fast online machine learning for Ruby
|
121
65
|
test_files: []
|