lightgbm 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +10 -4
- data/lib/lightgbm/dataset.rb +9 -4
- data/lib/lightgbm/utils.rb +5 -1
- data/lib/lightgbm/version.rb +1 -1
- 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: a4aac9eac1ab0dadbf31d1e1fc2714e75a8c37075538aef5c53b42df1c34f658
|
4
|
+
data.tar.gz: ca3a1043c55184992b3fac611963062d01747449f6170719ef1f299d4f0474c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2f14ccc3b40690060d2ee533cfe46e137f40e91520aab3eb188a8a03a697a6956853b717e743cd357d0a059836fc32e9e0aa0fbe5a7dd4263b1ff3e94e79601
|
7
|
+
data.tar.gz: 64abdb43f4c45222dcbb39ddde1d21350b2b4958439dc84d8f13684f4e9bcd3aa2c0e49aa8fd9ae1dfc09b8bc0ce69592e95aab0542684f3c952e9e67ac4689f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -129,16 +129,22 @@ Data can be an array of arrays
|
|
129
129
|
[[1, 2, 3], [4, 5, 6]]
|
130
130
|
```
|
131
131
|
|
132
|
-
Or a
|
132
|
+
Or a Numo NArray
|
133
133
|
|
134
134
|
```ruby
|
135
|
-
|
135
|
+
Numo::NArray.cast([[1, 2, 3], [4, 5, 6]])
|
136
136
|
```
|
137
137
|
|
138
|
-
Or a
|
138
|
+
Or a Rover data frame
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
Rover.read_csv("houses.csv")
|
142
|
+
```
|
143
|
+
|
144
|
+
Or a Daru data frame
|
139
145
|
|
140
146
|
```ruby
|
141
|
-
|
147
|
+
Daru::DataFrame.from_csv("houses.csv")
|
142
148
|
```
|
143
149
|
|
144
150
|
## Helpful Resources
|
data/lib/lightgbm/dataset.rb
CHANGED
@@ -130,18 +130,23 @@ module LightGBM
|
|
130
130
|
elsif daru?(data)
|
131
131
|
nrow, ncol = data.shape
|
132
132
|
flat_data = data.map_rows(&:to_a).flatten
|
133
|
-
elsif
|
133
|
+
elsif numo?(data) || rover?(data)
|
134
|
+
data = data.to_numo if rover?(data)
|
134
135
|
nrow, ncol = data.shape
|
135
|
-
flat_data = data.flatten.to_a
|
136
136
|
else
|
137
137
|
nrow = data.count
|
138
138
|
ncol = data.first.count
|
139
139
|
flat_data = data.flatten
|
140
140
|
end
|
141
141
|
|
142
|
-
handle_missing(flat_data)
|
143
142
|
c_data = ::FFI::MemoryPointer.new(:double, nrow * ncol)
|
144
|
-
|
143
|
+
if numo?(data)
|
144
|
+
c_data.write_bytes(data.cast_to(Numo::DFloat).to_string)
|
145
|
+
else
|
146
|
+
handle_missing(flat_data)
|
147
|
+
c_data.write_array_of_double(flat_data)
|
148
|
+
end
|
149
|
+
|
145
150
|
check_result FFI.LGBM_DatasetCreateFromMat(c_data, 1, nrow, ncol, 1, parameters, reference, @handle)
|
146
151
|
end
|
147
152
|
ObjectSpace.define_finalizer(self, self.class.finalize(handle_pointer)) unless used_indices
|
data/lib/lightgbm/utils.rb
CHANGED
@@ -37,8 +37,12 @@ module LightGBM
|
|
37
37
|
defined?(Daru::DataFrame) && data.is_a?(Daru::DataFrame)
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def numo?(data)
|
41
41
|
defined?(Numo::NArray) && data.is_a?(Numo::NArray)
|
42
42
|
end
|
43
|
+
|
44
|
+
def rover?(data)
|
45
|
+
defined?(Rover::DataFrame) && data.is_a?(Rover::DataFrame)
|
46
|
+
end
|
43
47
|
end
|
44
48
|
end
|
data/lib/lightgbm/version.rb
CHANGED
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|