eps 0.5.0 → 0.6.0

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: d93161edfe5b26ce55bbdafedfa4ead7fad756cc0f3e921f2b970a49c97bb5fc
4
- data.tar.gz: 5d0e4f8326a6e446efbe0a4a6f9e8e6435b7314ac4dba737d87bbe4b73c4e04a
3
+ metadata.gz: 701cde7907172e33d54d05ee0f2236dbfa84486744e7a510190618848c878418
4
+ data.tar.gz: a6be730db321a5143e34727497c6ed675f8d734b6195cd4fdc5f8e6bc4e98ff1
5
5
  SHA512:
6
- metadata.gz: e387214353fdf13608d48b306db3ce1b635eb3977f052d1d47b3e2b8cbe0c14628e01ca1d4291eaa9d3fb833864ff02628817155275d2105a069d2f4a866b8b3
7
- data.tar.gz: b27237a71a7198719b3000f385ea946547258f789f1a650cc348ed38d96e49c4d56b01149917807c97200aa737d6864739094c91d86ab8bafdd29e96e25e0d3b
6
+ metadata.gz: 6c76ec99a116a91cb9550b9a007b3150689b76649b14aa0c85582176fb44a08957b37c40e54ed1adb6447d8c5ec06757a611fad51a582581031f5724317ee888
7
+ data.tar.gz: 2176bf4351c26df4562a2879ecb2f0637d2d23bb624dc683790befa2029c2a3d89388b7d5b3183d4d48789801068d7442807c28c2a53439089e2ba0943e0bc9b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.6.0 (2025-02-01)
2
+
3
+ - Dropped support for Ruby < 3.1
4
+
1
5
  ## 0.5.0 (2023-07-02)
2
6
 
3
7
  - Dropped support for Ruby < 3
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-2023 Andrew Kane
3
+ Copyright (c) 2018-2024 Andrew Kane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -7,7 +7,7 @@ Machine learning for Ruby
7
7
 
8
8
  Check out [this post](https://ankane.org/rails-meet-data-science) for more info on machine learning with Rails
9
9
 
10
- [![Build Status](https://github.com/ankane/eps/workflows/build/badge.svg?branch=master)](https://github.com/ankane/eps/actions)
10
+ [![Build Status](https://github.com/ankane/eps/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/eps/actions)
11
11
 
12
12
  ## Installation
13
13
 
@@ -414,7 +414,7 @@ Eps::Model.new(data, validation_set: validation_set)
414
414
  Split on a specific value
415
415
 
416
416
  ```ruby
417
- Eps::Model.new(data, split: {column: :listed_at, value: Date.parse("2019-01-01")})
417
+ Eps::Model.new(data, split: {column: :listed_at, value: Date.parse("2025-01-01")})
418
418
  ```
419
419
 
420
420
  Specify the validation set size (the default is `0.25`, which is 25%)
@@ -435,7 +435,7 @@ The database is another place you can store models. It’s good if you retrain m
435
435
 
436
436
  > We recommend adding monitoring and guardrails as well if you retrain automatically
437
437
 
438
- Create an ActiveRecord model to store the predictive model.
438
+ Create an Active Record model to store the predictive model.
439
439
 
440
440
  ```sh
441
441
  rails generate model Model key:string:uniq data:text
@@ -479,61 +479,7 @@ Weights are supported for metrics as well
479
479
  Eps.metrics(actual, predicted, weight: weight)
480
480
  ```
481
481
 
482
- Reweighing is one method to [mitigate bias](http://aif360.mybluemix.net/) in training data
483
-
484
- ## Upgrading
485
-
486
- ## 0.3.0
487
-
488
- Eps 0.3.0 brings a number of improvements, including support for LightGBM and cross-validation. There are a number of breaking changes to be aware of:
489
-
490
- - LightGBM is now the default for new models. On Mac, run:
491
-
492
- ```sh
493
- brew install libomp
494
- ```
495
-
496
- Pass the `algorithm` option to use linear regression or naive Bayes.
497
-
498
- ```ruby
499
- Eps::Model.new(data, algorithm: :linear_regression) # or :naive_bayes
500
- ```
501
-
502
- - Cross-validation happens automatically by default. You no longer need to create training and test sets manually. If you were splitting on a time, use:
503
-
504
- ```ruby
505
- Eps::Model.new(data, split: {column: :listed_at, value: Date.parse("2019-01-01")})
506
- ```
507
-
508
- Or randomly, use:
509
-
510
- ```ruby
511
- Eps::Model.new(data, split: {validation_size: 0.3})
512
- ```
513
-
514
- To continue splitting manually, use:
515
-
516
- ```ruby
517
- Eps::Model.new(data, validation_set: test_set)
518
- ```
519
-
520
- - It’s no longer possible to load models in JSON or PFA formats. Retrain models and save them as PMML.
521
-
522
- ## 0.2.0
523
-
524
- Eps 0.2.0 brings a number of improvements, including support for classification.
525
-
526
- We recommend:
527
-
528
- 1. Changing `Eps::Regressor` to `Eps::Model`
529
- 2. Converting models from JSON to PMML
530
-
531
- ```ruby
532
- model = Eps::Model.load_json("model.json")
533
- File.write("model.pmml", model.to_pmml)
534
- ```
535
-
536
- 3. Renaming `app/stats_models` to `app/ml_models`
482
+ Reweighing is one method to [mitigate bias](https://fairlearn.org/) in training data
537
483
 
538
484
  ## History
539
485
 
@@ -226,7 +226,7 @@ module Eps
226
226
  end
227
227
 
228
228
  encoder.vocabulary.each do |word|
229
- train_set.columns[[k, word]] = [0] * counts.size
229
+ train_set.columns[[k, word]] = Array.new(counts.size, 0)
230
230
  end
231
231
 
232
232
  counts.each_with_index do |ci, i|
@@ -13,7 +13,7 @@ module Eps
13
13
  raise "Probabilities not supported" if probabilities
14
14
 
15
15
  intercept = @coefficients["_intercept"] || 0.0
16
- scores = [intercept] * x.size
16
+ scores = Array.new(x.size, intercept)
17
17
 
18
18
  @features.each do |k, type|
19
19
  raise "Missing data in #{k}" if !x.columns[k] || x.columns[k].any?(&:nil?)
@@ -33,7 +33,7 @@ module Eps
33
33
  total = probabilities[:prior].values.sum.to_f
34
34
  probabilities[:prior].each do |c, cv|
35
35
  prior = Math.log(cv / total)
36
- px = [prior] * x.size
36
+ px = Array.new(x.size, prior)
37
37
 
38
38
  @features.each do |k, type|
39
39
  case type
data/lib/eps/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eps
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-07-02 00:00:00.000000000 Z
10
+ date: 2025-02-01 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: lightgbm
@@ -52,7 +51,6 @@ dependencies:
52
51
  - - ">="
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
55
- description:
56
54
  email: andrew@ankane.org
57
55
  executables: []
58
56
  extensions: []
@@ -86,7 +84,6 @@ homepage: https://github.com/ankane/eps
86
84
  licenses:
87
85
  - MIT
88
86
  metadata: {}
89
- post_install_message:
90
87
  rdoc_options: []
91
88
  require_paths:
92
89
  - lib
@@ -94,15 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
91
  requirements:
95
92
  - - ">="
96
93
  - !ruby/object:Gem::Version
97
- version: '3'
94
+ version: '3.1'
98
95
  required_rubygems_version: !ruby/object:Gem::Requirement
99
96
  requirements:
100
97
  - - ">="
101
98
  - !ruby/object:Gem::Version
102
99
  version: '0'
103
100
  requirements: []
104
- rubygems_version: 3.4.10
105
- signing_key:
101
+ rubygems_version: 3.6.2
106
102
  specification_version: 4
107
103
  summary: Machine learning for Ruby. Supports regression (linear regression) and classification
108
104
  (naive Bayes)