lightgbm 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dad09a50916e229119d99de66aa676868224af44d8958916284718edb7fb3a3f
4
- data.tar.gz: 2f7d299a7037455a4ebd1ccaf41bc102ec66808b9e806a59194fd14699204364
3
+ metadata.gz: 7c609f529612c4aef7c34ecd59bb1b12df1d2b9bfb64ddae8e8a1eb4f5a8a2af
4
+ data.tar.gz: c0d1d48a5301dd66d5df8feee81e64140eb058dd1c38b1fccd8564b125d22aab
5
5
  SHA512:
6
- metadata.gz: aa415946a82be07f1b9b8823b60fc75030f9e5547859078459583fa64d9212aad11db39d30e8e327b1fe23f48fc2ce9c6ddbd0445b52f73b44374a07c4724f5c
7
- data.tar.gz: 99357888fde412672ecd804396cbd3a524b7dee6318d46d92a07064b858cd5f62f144f6b680a25ae0f1ae567df7d4670fcf38ba706fa31cbdfe58fd79eabc62d
6
+ metadata.gz: 5c2b002aa6e97a4d12de0076999c07be4077b6510f0b6a29cc6eb5d5f5ec23f2387ae52e82be0ab36ec2b00e27a93b337985ce1595de2845396ff9997c3172d5
7
+ data.tar.gz: ab3e47fb5c973576fc01632a0c1bf7479245f3037f61041c6c8596bd82ca2d37e1979474153e4a99302c5b276e98b7ed7772e0e00db21dcc90d4360bd775ed62
@@ -1,3 +1,8 @@
1
+ ## 0.1.6
2
+
3
+ - Updated LightGBM to 2.3.0
4
+ - Fixed error with JRuby
5
+
1
6
  ## 0.1.5
2
7
 
3
8
  - Packaged LightGBM with gem
data/README.md CHANGED
@@ -14,7 +14,7 @@ Add this line to your application’s Gemfile:
14
14
  gem 'lightgbm'
15
15
  ```
16
16
 
17
- LightGBM is packaged with the gem, so no need to install it separately. On Mac, also run:
17
+ On Mac, also install OpenMP:
18
18
 
19
19
  ```sh
20
20
  brew install libomp
@@ -40,7 +40,7 @@ module LightGBM
40
40
  out_len = ::FFI::MemoryPointer.new(:int64)
41
41
  out_str = ::FFI::MemoryPointer.new(:string, buffer_len)
42
42
  check_result FFI.LGBM_BoosterDumpModel(handle_pointer, start_iteration, num_iteration, buffer_len, out_len, out_str)
43
- actual_len = out_len.read_int64
43
+ actual_len = read_int64(out_len)
44
44
  if actual_len > buffer_len
45
45
  out_str = ::FFI::MemoryPointer.new(:string, actual_len)
46
46
  check_result FFI.LGBM_BoosterDumpModel(handle_pointer, start_iteration, num_iteration, actual_len, out_len, out_str)
@@ -87,7 +87,7 @@ module LightGBM
87
87
  out_len = ::FFI::MemoryPointer.new(:int64)
88
88
  out_str = ::FFI::MemoryPointer.new(:string, buffer_len)
89
89
  check_result FFI.LGBM_BoosterSaveModelToString(handle_pointer, start_iteration, num_iteration, buffer_len, out_len, out_str)
90
- actual_len = out_len.read_int64
90
+ actual_len = read_int64(out_len)
91
91
  if actual_len > buffer_len
92
92
  out_str = ::FFI::MemoryPointer.new(:string, actual_len)
93
93
  check_result FFI.LGBM_BoosterSaveModelToString(handle_pointer, start_iteration, num_iteration, actual_len, out_len, out_str)
@@ -137,7 +137,7 @@ module LightGBM
137
137
  out_len = ::FFI::MemoryPointer.new(:int64)
138
138
  out_result = ::FFI::MemoryPointer.new(:double, num_class * input.count)
139
139
  check_result FFI.LGBM_BoosterPredictForMat(handle_pointer, data, 0, input.count, input.first.count, 1, 0, num_iteration, params_str(params), out_len, out_result)
140
- out = out_result.read_array_of_double(out_len.read_int64)
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
 
143
143
  singular ? out.first : out
@@ -202,6 +202,11 @@ module LightGBM
202
202
  out.read_int
203
203
  end
204
204
 
205
+ # read_int64 not available on JRuby
206
+ def read_int64(ptr)
207
+ ptr.read_array_of_int64(1).first
208
+ end
209
+
205
210
  include Utils
206
211
  end
207
212
  end
@@ -103,11 +103,6 @@ module LightGBM
103
103
  check_result FFI.LGBM_DatasetSaveBinary(handle_pointer, filename)
104
104
  end
105
105
 
106
- # not released yet
107
- # def dump_text(filename)
108
- # check_result FFI.LGBM_DatasetDumpText(handle_pointer, filename)
109
- # end
110
-
111
106
  def subset(used_indices, params: nil)
112
107
  # categorical_feature passed via params
113
108
  params ||= self.params
@@ -129,6 +124,10 @@ module LightGBM
129
124
 
130
125
  private
131
126
 
127
+ def dump_text(filename)
128
+ check_result FFI.LGBM_DatasetDumpText(handle_pointer, filename)
129
+ end
130
+
132
131
  def field(field_name)
133
132
  num_data = self.num_data
134
133
  out_len = ::FFI::MemoryPointer.new(:int)
@@ -26,7 +26,7 @@ module LightGBM
26
26
  attach_function :LGBM_DatasetGetFeatureNames, %i[pointer pointer pointer], :int
27
27
  attach_function :LGBM_DatasetFree, %i[pointer], :int
28
28
  attach_function :LGBM_DatasetSaveBinary, %i[pointer string], :int
29
- # attach_function :LGBM_DatasetDumpText, %i[pointer string], :int
29
+ attach_function :LGBM_DatasetDumpText, %i[pointer string], :int
30
30
  attach_function :LGBM_DatasetSetField, %i[pointer string pointer int int], :int
31
31
  attach_function :LGBM_DatasetGetField, %i[pointer string pointer pointer pointer], :int
32
32
  attach_function :LGBM_DatasetGetNumData, %i[pointer pointer], :int
@@ -1,3 +1,3 @@
1
1
  module LightGBM
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
Binary file
Binary file
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.5
4
+ version: 0.1.6
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-09-03 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: numo-narray
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  description:
98
84
  email: andrew@chartkick.com
99
85
  executables: []