lightgbm 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -7
- data/README.md +11 -1
- data/lib/lightgbm/booster.rb +14 -14
- data/lib/lightgbm/dataset.rb +8 -8
- data/lib/lightgbm/version.rb +1 -1
- data/vendor/lib_lightgbm.dll +0 -0
- data/vendor/lib_lightgbm.dylib +0 -0
- data/vendor/lib_lightgbm.so +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf13db584839dc0cb0a9b6d2480a6846704aee74f6a984300db06901cfbb1e66
|
4
|
+
data.tar.gz: ec716f3a2354c28e916b4ae89bd567e222f8bb5e5415e9579fb3c67def9c8edc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db7d6da179096a0648b2257c575383e9a59caa6bae04f39275aafe9126e69b51c6048c1452d2fb8dffa538362614efe83f7c05a8df4c749808040835a977623c
|
7
|
+
data.tar.gz: 5ebecf54455d3aef8ff3235e196bc064353bb7379a8b6fa61671feb223813ac6d028d7b86a0c9ada0568b06d048c6fcfdea48f082d208edaecbfdb54ead75d33
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
-
## 0.1.
|
1
|
+
## 0.1.7 (2019-12-05)
|
2
|
+
|
3
|
+
- Updated LightGBM to 2.3.1
|
4
|
+
- Switched to doubles for datasets and predictions
|
5
|
+
|
6
|
+
## 0.1.6 (2019-09-29)
|
2
7
|
|
3
8
|
- Updated LightGBM to 2.3.0
|
4
9
|
- Fixed error with JRuby
|
5
10
|
|
6
|
-
## 0.1.5
|
11
|
+
## 0.1.5 (2019-09-03)
|
7
12
|
|
8
13
|
- Packaged LightGBM with gem
|
9
14
|
- Added support for missing values
|
10
15
|
- Added `feature_names` to datasets
|
11
16
|
- Fixed Daru training and prediction
|
12
17
|
|
13
|
-
## 0.1.4
|
18
|
+
## 0.1.4 (2019-08-19)
|
14
19
|
|
15
20
|
- Friendlier message when LightGBM not found
|
16
21
|
- Added `Ranker`
|
@@ -18,22 +23,22 @@
|
|
18
23
|
- Free memory when objects are destroyed
|
19
24
|
- Removed unreleased `dump_text` method
|
20
25
|
|
21
|
-
## 0.1.3
|
26
|
+
## 0.1.3 (2019-08-16)
|
22
27
|
|
23
28
|
- Added Scikit-Learn API
|
24
29
|
- Added support for Daru and Numo::NArray
|
25
30
|
|
26
|
-
## 0.1.2
|
31
|
+
## 0.1.2 (2019-08-15)
|
27
32
|
|
28
33
|
- Added `cv` method
|
29
34
|
- Added early stopping
|
30
35
|
- Fixed multiclass classification
|
31
36
|
|
32
|
-
## 0.1.1
|
37
|
+
## 0.1.1 (2019-08-14)
|
33
38
|
|
34
39
|
- Added training API
|
35
40
|
- Added many methods
|
36
41
|
|
37
|
-
## 0.1.0
|
42
|
+
## 0.1.0 (2019-08-13)
|
38
43
|
|
39
44
|
- First release
|
data/README.md
CHANGED
@@ -165,7 +165,7 @@ Numo::DFloat.new(3, 2).seq
|
|
165
165
|
|
166
166
|
## Credits
|
167
167
|
|
168
|
-
Thanks to the [xgboost](https://github.com/PairOnAir/xgboost-ruby) gem for serving as an initial reference
|
168
|
+
Thanks to the [xgboost](https://github.com/PairOnAir/xgboost-ruby) gem for serving as an initial reference.
|
169
169
|
|
170
170
|
## History
|
171
171
|
|
@@ -179,3 +179,13 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
|
|
179
179
|
- Fix bugs and [submit pull requests](https://github.com/ankane/lightgbm/pulls)
|
180
180
|
- Write, clarify, or fix documentation
|
181
181
|
- Suggest or add new features
|
182
|
+
|
183
|
+
To get started with development and testing:
|
184
|
+
|
185
|
+
```sh
|
186
|
+
git clone https://github.com/ankane/lightgbm.git
|
187
|
+
cd lightgbm
|
188
|
+
bundle install
|
189
|
+
bundle exec rake vendor:all
|
190
|
+
bundle exec rake test
|
191
|
+
```
|
data/lib/lightgbm/booster.rb
CHANGED
@@ -30,7 +30,7 @@ module LightGBM
|
|
30
30
|
|
31
31
|
def current_iteration
|
32
32
|
out = ::FFI::MemoryPointer.new(:int)
|
33
|
-
check_result FFI
|
33
|
+
check_result FFI.LGBM_BoosterGetCurrentIteration(handle_pointer, out)
|
34
34
|
out.read_int
|
35
35
|
end
|
36
36
|
|
@@ -38,11 +38,11 @@ module LightGBM
|
|
38
38
|
num_iteration ||= best_iteration
|
39
39
|
buffer_len = 1 << 20
|
40
40
|
out_len = ::FFI::MemoryPointer.new(:int64)
|
41
|
-
out_str = ::FFI::MemoryPointer.new(:
|
41
|
+
out_str = ::FFI::MemoryPointer.new(:char, buffer_len)
|
42
42
|
check_result FFI.LGBM_BoosterDumpModel(handle_pointer, start_iteration, num_iteration, buffer_len, out_len, out_str)
|
43
43
|
actual_len = read_int64(out_len)
|
44
44
|
if actual_len > buffer_len
|
45
|
-
out_str = ::FFI::MemoryPointer.new(:
|
45
|
+
out_str = ::FFI::MemoryPointer.new(:char, actual_len)
|
46
46
|
check_result FFI.LGBM_BoosterDumpModel(handle_pointer, start_iteration, num_iteration, actual_len, out_len, out_str)
|
47
47
|
end
|
48
48
|
out_str.read_string
|
@@ -85,11 +85,11 @@ module LightGBM
|
|
85
85
|
num_iteration ||= best_iteration
|
86
86
|
buffer_len = 1 << 20
|
87
87
|
out_len = ::FFI::MemoryPointer.new(:int64)
|
88
|
-
out_str = ::FFI::MemoryPointer.new(:
|
88
|
+
out_str = ::FFI::MemoryPointer.new(:char, buffer_len)
|
89
89
|
check_result FFI.LGBM_BoosterSaveModelToString(handle_pointer, start_iteration, num_iteration, buffer_len, out_len, out_str)
|
90
90
|
actual_len = read_int64(out_len)
|
91
91
|
if actual_len > buffer_len
|
92
|
-
out_str = ::FFI::MemoryPointer.new(:
|
92
|
+
out_str = ::FFI::MemoryPointer.new(:char, actual_len)
|
93
93
|
check_result FFI.LGBM_BoosterSaveModelToString(handle_pointer, start_iteration, num_iteration, actual_len, out_len, out_str)
|
94
94
|
end
|
95
95
|
out_str.read_string
|
@@ -104,13 +104,13 @@ module LightGBM
|
|
104
104
|
|
105
105
|
def num_model_per_iteration
|
106
106
|
out = ::FFI::MemoryPointer.new(:int)
|
107
|
-
check_result FFI
|
107
|
+
check_result FFI.LGBM_BoosterNumModelPerIteration(handle_pointer, out)
|
108
108
|
out.read_int
|
109
109
|
end
|
110
110
|
|
111
111
|
def num_trees
|
112
112
|
out = ::FFI::MemoryPointer.new(:int)
|
113
|
-
check_result FFI
|
113
|
+
check_result FFI.LGBM_BoosterNumberOfTotalModel(handle_pointer, out)
|
114
114
|
out.read_int
|
115
115
|
end
|
116
116
|
|
@@ -131,12 +131,12 @@ module LightGBM
|
|
131
131
|
|
132
132
|
flat_input = input.flatten
|
133
133
|
handle_missing(flat_input)
|
134
|
-
data = ::FFI::MemoryPointer.new(:
|
135
|
-
data.
|
134
|
+
data = ::FFI::MemoryPointer.new(:double, input.count * input.first.count)
|
135
|
+
data.write_array_of_double(flat_input)
|
136
136
|
|
137
137
|
out_len = ::FFI::MemoryPointer.new(:int64)
|
138
138
|
out_result = ::FFI::MemoryPointer.new(:double, num_class * input.count)
|
139
|
-
check_result FFI.LGBM_BoosterPredictForMat(handle_pointer, data,
|
139
|
+
check_result FFI.LGBM_BoosterPredictForMat(handle_pointer, data, 1, input.count, input.first.count, 1, 0, num_iteration, params_str(params), out_len, out_result)
|
140
140
|
out = out_result.read_array_of_double(read_int64(out_len))
|
141
141
|
out = out.each_slice(num_class).to_a if num_class > 1
|
142
142
|
|
@@ -168,7 +168,7 @@ module LightGBM
|
|
168
168
|
|
169
169
|
def eval_counts
|
170
170
|
out = ::FFI::MemoryPointer.new(:int)
|
171
|
-
check_result FFI
|
171
|
+
check_result FFI.LGBM_BoosterGetEvalCounts(handle_pointer, out)
|
172
172
|
out.read_int
|
173
173
|
end
|
174
174
|
|
@@ -176,8 +176,8 @@ module LightGBM
|
|
176
176
|
eval_counts ||= eval_counts()
|
177
177
|
out_len = ::FFI::MemoryPointer.new(:int)
|
178
178
|
out_strs = ::FFI::MemoryPointer.new(:pointer, eval_counts)
|
179
|
-
str_ptrs = eval_counts.times.map { ::FFI::MemoryPointer.new(:
|
180
|
-
out_strs.
|
179
|
+
str_ptrs = eval_counts.times.map { ::FFI::MemoryPointer.new(:char, 255) }
|
180
|
+
out_strs.write_array_of_pointer(str_ptrs)
|
181
181
|
check_result FFI.LGBM_BoosterGetEvalNames(handle_pointer, out_len, out_strs)
|
182
182
|
str_ptrs.map(&:read_string)
|
183
183
|
end
|
@@ -198,7 +198,7 @@ module LightGBM
|
|
198
198
|
|
199
199
|
def num_class
|
200
200
|
out = ::FFI::MemoryPointer.new(:int)
|
201
|
-
check_result FFI
|
201
|
+
check_result FFI.LGBM_BoosterGetNumClasses(handle_pointer, out)
|
202
202
|
out.read_int
|
203
203
|
end
|
204
204
|
|
data/lib/lightgbm/dataset.rb
CHANGED
@@ -17,7 +17,7 @@ module LightGBM
|
|
17
17
|
reference = reference.handle_pointer if reference
|
18
18
|
if used_indices
|
19
19
|
used_row_indices = ::FFI::MemoryPointer.new(:int32, used_indices.count)
|
20
|
-
used_row_indices.
|
20
|
+
used_row_indices.write_array_of_int32(used_indices)
|
21
21
|
check_result FFI.LGBM_DatasetGetSubset(reference, used_row_indices, used_indices.count, parameters, @handle)
|
22
22
|
elsif data.is_a?(String)
|
23
23
|
check_result FFI.LGBM_DatasetCreateFromFile(data, parameters, reference, @handle)
|
@@ -39,9 +39,9 @@ module LightGBM
|
|
39
39
|
end
|
40
40
|
|
41
41
|
handle_missing(flat_data)
|
42
|
-
c_data = ::FFI::MemoryPointer.new(:
|
43
|
-
c_data.
|
44
|
-
check_result FFI.LGBM_DatasetCreateFromMat(c_data,
|
42
|
+
c_data = ::FFI::MemoryPointer.new(:double, nrow * ncol)
|
43
|
+
c_data.write_array_of_double(flat_data)
|
44
|
+
check_result FFI.LGBM_DatasetCreateFromMat(c_data, 1, nrow, ncol, 1, parameters, reference, @handle)
|
45
45
|
end
|
46
46
|
ObjectSpace.define_finalizer(self, self.class.finalize(handle_pointer)) unless used_indices
|
47
47
|
|
@@ -67,8 +67,8 @@ module LightGBM
|
|
67
67
|
# must preallocate space
|
68
68
|
num_feature_names = ::FFI::MemoryPointer.new(:int)
|
69
69
|
out_strs = ::FFI::MemoryPointer.new(:pointer, 1000)
|
70
|
-
str_ptrs = 1000.times.map { ::FFI::MemoryPointer.new(:
|
71
|
-
out_strs.
|
70
|
+
str_ptrs = 1000.times.map { ::FFI::MemoryPointer.new(:char, 255) }
|
71
|
+
out_strs.write_array_of_pointer(str_ptrs)
|
72
72
|
check_result FFI.LGBM_DatasetGetFeatureNames(handle_pointer, out_strs, num_feature_names)
|
73
73
|
str_ptrs[0, num_feature_names.read_int].map(&:read_string)
|
74
74
|
end
|
@@ -141,11 +141,11 @@ module LightGBM
|
|
141
141
|
data = data.to_a unless data.is_a?(Array)
|
142
142
|
if type == :int32
|
143
143
|
c_data = ::FFI::MemoryPointer.new(:int32, data.count)
|
144
|
-
c_data.
|
144
|
+
c_data.write_array_of_int32(data)
|
145
145
|
check_result FFI.LGBM_DatasetSetField(handle_pointer, field_name, c_data, data.count, 2)
|
146
146
|
else
|
147
147
|
c_data = ::FFI::MemoryPointer.new(:float, data.count)
|
148
|
-
c_data.
|
148
|
+
c_data.write_array_of_float(data)
|
149
149
|
check_result FFI.LGBM_DatasetSetField(handle_pointer, field_name, c_data, data.count, 0)
|
150
150
|
end
|
151
151
|
end
|
data/lib/lightgbm/version.rb
CHANGED
data/vendor/lib_lightgbm.dll
CHANGED
Binary file
|
data/vendor/lib_lightgbm.dylib
CHANGED
Binary file
|
data/vendor/lib_lightgbm.so
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightgbm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|