eps 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a59850fe508d404a023145710505e721f1bfc24935a30a090aee09d179887d3a
4
- data.tar.gz: 8218bc5bb63ee5ebbd23a8e9a129bcd76789b1f6bb628d57b015f1d5740183ac
3
+ metadata.gz: 50f5a4273111ebc5ba1265d07d4e925d770006fce330b01cfbe4fe97221548d9
4
+ data.tar.gz: a785ca5533618243b933248ef2f418c5d0d048d8ff1051c9a2e7fae5f8c87ba3
5
5
  SHA512:
6
- metadata.gz: db1011e9228763dc0a98e1e57d1c9e18a297d362cea18b33bf8eeffecce853ea49d4273ae4e782a6de2be37711e9e6373810e5517558248489e696b477c0848b
7
- data.tar.gz: 6b9f52453be9d2ad7a29a4703508763988447de64a7599c53f9b9d3b0135e105130aba3c2679fed17ea60ba7242b6bd0d3cac9c5c2b796fe93f9009f0bbbcb30
6
+ metadata.gz: 3adffd0fbb0d16163a06720adfd97a83c6bf4bf2554e30b3a6f3599828511834826477a8296f93720c3efd52d19ca412e8b7695b013a4e7361073e3c5bcf5ee5
7
+ data.tar.gz: 69847d6d49742f61b3b4fac6e9298e5c954d4cc22e5302b716f258e6190f71df4eee1820e844c4159e1fdf99385a36c2cb697065e78d5f6557c6d1dbca70f9de
@@ -1,7 +1,12 @@
1
+ ## 0.3.2 (2019-12-08)
2
+
3
+ - Added support for GSLR
4
+
1
5
  ## 0.3.1 (2019-12-06)
2
6
 
3
7
  - Added `weight` option for LightGBM and linear regression
4
8
  - Added `intercept` option for linear regression
9
+ - Added LightGBM evaluator safety check
5
10
  - Fixed `Unknown label` error for LightGBM
6
11
  - Fixed error message for unstable solutions with linear regression
7
12
 
data/README.md CHANGED
@@ -355,6 +355,8 @@ Eps supports:
355
355
 
356
356
  ### Linear Regression
357
357
 
358
+ #### Performance
359
+
358
360
  To speed up training on large datasets with linear regression, [install GSL](https://www.gnu.org/software/gsl/). With Homebrew, you can use:
359
361
 
360
362
  ```sh
@@ -364,11 +366,13 @@ brew install gsl
364
366
  Then, add this line to your application’s Gemfile:
365
367
 
366
368
  ```ruby
367
- gem 'gsl', group: :development
369
+ gem 'gslr', group: :development
368
370
  ```
369
371
 
370
372
  It only needs to be available in environments used to build the model.
371
373
 
374
+ #### Options
375
+
372
376
  By default, an intercept is included. Disable this with:
373
377
 
374
378
  ```ruby
@@ -50,17 +50,35 @@ module Eps
50
50
 
51
51
  x = data.map_rows(&:to_a)
52
52
 
53
+ gsl =
54
+ if options.key?(:gsl)
55
+ options[:gsl]
56
+ elsif defined?(GSL)
57
+ true
58
+ elsif defined?(GSLR)
59
+ :gslr
60
+ else
61
+ false
62
+ end
63
+
53
64
  intercept = @options.key?(:intercept) ? @options[:intercept] : true
54
- if intercept
65
+ if intercept && gsl != :gslr
55
66
  data.size.times do |i|
56
67
  x[i].unshift(1)
57
68
  end
58
69
  end
59
70
 
60
- gsl = options.key?(:gsl) ? options[:gsl] : defined?(GSL)
61
-
62
71
  v3 =
63
- if gsl
72
+ if gsl == :gslr
73
+ model = GSLR::OLS.new(intercept: intercept)
74
+ model.fit(x, data.label, weight: data.weight)
75
+
76
+ @covariance = model.covariance
77
+
78
+ coefficients = model.coefficients.dup
79
+ coefficients.unshift(model.intercept) if intercept
80
+ coefficients
81
+ elsif gsl
64
82
  x = GSL::Matrix.alloc(*x)
65
83
  y = GSL::Vector.alloc(data.label)
66
84
  w = GSL::Vector.alloc(data.weight) if data.weight
@@ -196,7 +214,11 @@ module Eps
196
214
 
197
215
  def diagonal
198
216
  @diagonal ||= begin
199
- if covariance.respond_to?(:each)
217
+ if covariance.is_a?(Array)
218
+ covariance.size.times.map do |i|
219
+ covariance[i][i]
220
+ end
221
+ elsif covariance.respond_to?(:each)
200
222
  d = covariance.each(:diagonal).to_a
201
223
  @removed.each do |i|
202
224
  d.insert(i, 0)
@@ -1,3 +1,3 @@
1
1
  module Eps
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
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-12-06 00:00:00.000000000 Z
11
+ date: 2019-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lightgbm