rumale 0.18.7 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/Gemfile +2 -0
- data/README.md +5 -36
- data/lib/rumale/decomposition/pca.rb +23 -5
- data/lib/rumale/feature_extraction/feature_hasher.rb +14 -1
- data/lib/rumale/linear_model/base_linear_model.rb +1 -0
- data/lib/rumale/metric_learning/neighbourhood_component_analysis.rb +13 -1
- data/lib/rumale/optimizer/ada_grad.rb +3 -0
- data/lib/rumale/optimizer/adam.rb +3 -0
- data/lib/rumale/optimizer/nadam.rb +5 -0
- data/lib/rumale/optimizer/rmsprop.rb +3 -0
- data/lib/rumale/optimizer/sgd.rb +3 -0
- data/lib/rumale/optimizer/yellow_fin.rb +3 -0
- data/lib/rumale/polynomial_model/base_factorization_machine.rb +4 -0
- data/lib/rumale/polynomial_model/factorization_machine_classifier.rb +5 -0
- data/lib/rumale/polynomial_model/factorization_machine_regressor.rb +5 -0
- data/lib/rumale/version.rb +1 -1
- data/rumale.gemspec +1 -3
- metadata +3 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cd1cdc16e6c72743d064db7d254c74eb98ca33e97cfdf9e8a76cc1fbe5dd29b
|
4
|
+
data.tar.gz: 2077cae2629f2c403cc0afc415dc4b4151a2eac2ab7a3230402bf761bb653829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bbcdce6d0a31c95500a81a7d4a55407786068fac65ce1e5ede1bc3f56d97b2ec93fd9ca1dc52fc1a24782dba469099b25d0398a5993716da011851f18f8179c
|
7
|
+
data.tar.gz: cc9fc19ea73dfa76e8ede18df7cb57f931cccdea2c546f414746ed681afbd272e3866913c75534bbdce6b275d057baa2c793b4046c8e46f697e30d5b87dba066
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
# 0.19.0
|
2
|
+
- Change mmh3 and mopti gem to non-runtime dependent library.
|
3
|
+
- The mmh3 gem is used in [FeatureHasher](https://yoshoku.github.io/rumale/doc/Rumale/FeatureExtraction/FeatureHasher.html).
|
4
|
+
You only need to require mmh3 gem when using FeatureHasher.
|
5
|
+
```ruby
|
6
|
+
require 'mmh3'
|
7
|
+
require 'rumale'
|
8
|
+
|
9
|
+
encoder = Rumale::FeatureExtraction::FeatureHasher.new
|
10
|
+
```
|
11
|
+
- The mopti gem is used in [NeighbourhoodComponentAnalysis](https://yoshoku.github.io/rumale/doc/Rumale/MetricLearning/NeighbourhoodComponentAnalysis.html).
|
12
|
+
You only need to require mopti gem when using NeighbourhoodComponentAnalysis.
|
13
|
+
```ruby
|
14
|
+
require 'mopti'
|
15
|
+
require 'rumale'
|
16
|
+
|
17
|
+
transformer = Rumale::MetricLearning::NeighbourhoodComponentAnalysis.new
|
18
|
+
```
|
19
|
+
- Change the default value of solver parameter on [PCA](https://yoshoku.github.io/rumale/doc/Rumale/Decomposition/PCA.html) to 'auto'.
|
20
|
+
If Numo::Linalg is loaded, 'evd' is selected for the solver, otherwise 'fpt' is selected.
|
21
|
+
- Deprecate [PolynomialModel](https://yoshoku.github.io/rumale/doc/Rumale/PolynomialModel.html), [Optimizer](https://yoshoku.github.io/rumale/doc/Rumale/Optimizer.html), and the estimators contained in them. They will be deleted in version 0.20.0.
|
22
|
+
- Many machine learning libraries do not contain factorization machine algorithms, they are provided by another compatible library.
|
23
|
+
In addition, there are no plans to implement estimators in PolynomialModel.
|
24
|
+
Thus, the author decided to deprecate PolynomialModel.
|
25
|
+
- Currently, the Optimizer classes are only used by PolynomialModel estimators.
|
26
|
+
Therefore, they have been deprecated together with PolynomialModel.
|
27
|
+
|
1
28
|
# 0.18.7
|
2
29
|
- Fix to convert target_name to string array in [classification_report method](https://yoshoku.github.io/rumale/doc/Rumale/EvaluationMeasure.html#classification_report-class_method).
|
3
30
|
- Refactor some codes with Rubocop.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
Rumale (**Ru**by **ma**chine **le**arning) is a machine learning library in Ruby.
|
12
12
|
Rumale provides machine learning algorithms with interfaces similar to Scikit-Learn in Python.
|
13
13
|
Rumale supports Support Vector Machine,
|
14
|
-
Logistic Regression, Ridge, Lasso,
|
14
|
+
Logistic Regression, Ridge, Lasso,
|
15
15
|
Multi-layer Perceptron,
|
16
16
|
Naive Bayes, Decision Tree, Gradient Tree Boosting, Random Forest,
|
17
17
|
K-Means, Gaussian Mixture Model, DBSCAN, Spectral Clustering,
|
@@ -42,39 +42,7 @@ Or install it yourself as:
|
|
42
42
|
|
43
43
|
## Usage
|
44
44
|
|
45
|
-
### Example 1.
|
46
|
-
First, let's classify simple xor data.
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
require 'rumale'
|
50
|
-
|
51
|
-
# Prepare XOR data.
|
52
|
-
samples = [[0, 0], [0, 1], [1, 0], [1, 1]]
|
53
|
-
labels = [0, 1, 1, 0]
|
54
|
-
|
55
|
-
# Train classifier with nearest neighbor rule.
|
56
|
-
estimator = Rumale::NearestNeighbors::KNeighborsClassifier.new(n_neighbors: 1)
|
57
|
-
estimator.fit(samples, labels)
|
58
|
-
|
59
|
-
# Predict labels.
|
60
|
-
p labels
|
61
|
-
p estimator.predict(samples)
|
62
|
-
```
|
63
|
-
|
64
|
-
Execution of the above script result in the following.
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
[0, 1, 1, 0]
|
68
|
-
Numo::Int32#shape=[4]
|
69
|
-
[0, 1, 1, 0]
|
70
|
-
```
|
71
|
-
|
72
|
-
The basic usage of Rumale is to first train the model with the fit method
|
73
|
-
and then estimate with the predict method.
|
74
|
-
In addition, Rumale recommends using arrays such as feature vectors and labels with
|
75
|
-
[Numo::NArray](https://github.com/ruby-numo/numo-narray).
|
76
|
-
|
77
|
-
### Example 2. Pendigits dataset classification
|
45
|
+
### Example 1. Pendigits dataset classification
|
78
46
|
|
79
47
|
Rumale provides function loading libsvm format dataset file.
|
80
48
|
We start by downloading the pendigits dataset from LIBSVM Data web site.
|
@@ -137,7 +105,7 @@ $ ruby test.rb
|
|
137
105
|
Accuracy: 98.7%
|
138
106
|
```
|
139
107
|
|
140
|
-
### Example
|
108
|
+
### Example 2. Cross-validation
|
141
109
|
|
142
110
|
```ruby
|
143
111
|
require 'rumale'
|
@@ -168,7 +136,7 @@ $ ruby cross_validation.rb
|
|
168
136
|
5-CV mean log-loss: 0.355
|
169
137
|
```
|
170
138
|
|
171
|
-
### Example
|
139
|
+
### Example 3. Pipeline
|
172
140
|
|
173
141
|
```ruby
|
174
142
|
require 'rumale'
|
@@ -203,6 +171,7 @@ $ ruby pipeline.rb
|
|
203
171
|
## Speed up
|
204
172
|
|
205
173
|
### Numo::Linalg
|
174
|
+
Rumale uses [Numo::NArray](https://github.com/ruby-numo/numo-narray) for typed arrays.
|
206
175
|
Loading the [Numo::Linalg](https://github.com/ruby-numo/numo-linalg) allows to perform matrix product of Numo::NArray using BLAS libraries.
|
207
176
|
For example, using the [OpenBLAS](https://github.com/xianyi/OpenBLAS) speeds up many estimators in Rumale.
|
208
177
|
|
@@ -9,7 +9,7 @@ module Rumale
|
|
9
9
|
# PCA is a class that implements Principal Component Analysis.
|
10
10
|
#
|
11
11
|
# @example
|
12
|
-
# decomposer = Rumale::Decomposition::PCA.new(n_components: 2)
|
12
|
+
# decomposer = Rumale::Decomposition::PCA.new(n_components: 2, solver: 'fpt')
|
13
13
|
# representaion = decomposer.fit_transform(samples)
|
14
14
|
#
|
15
15
|
# # If Numo::Linalg is installed, you can specify 'evd' for the solver option.
|
@@ -17,6 +17,11 @@ module Rumale
|
|
17
17
|
# decomposer = Rumale::Decomposition::PCA.new(n_components: 2, solver: 'evd')
|
18
18
|
# representaion = decomposer.fit_transform(samples)
|
19
19
|
#
|
20
|
+
# # If Numo::Linalg is loaded and the solver option is not given,
|
21
|
+
# # the solver option is choosen 'evd' automatically.
|
22
|
+
# decomposer = Rumale::Decomposition::PCA.new(n_components: 2)
|
23
|
+
# representaion = decomposer.fit_transform(samples)
|
24
|
+
#
|
20
25
|
# *Reference*
|
21
26
|
# - Sharma, A., and Paliwal, K K., "Fast principal component analysis using fixed-point algorithm," Pattern Recognition Letters, 28, pp. 1151--1155, 2007.
|
22
27
|
class PCA
|
@@ -38,18 +43,24 @@ module Rumale
|
|
38
43
|
# Create a new transformer with PCA.
|
39
44
|
#
|
40
45
|
# @param n_components [Integer] The number of principal components.
|
41
|
-
# @param solver [String] The algorithm for the optimization ('fpt' or 'evd').
|
42
|
-
# '
|
46
|
+
# @param solver [String] The algorithm for the optimization ('auto', 'fpt' or 'evd').
|
47
|
+
# 'auto' chooses the 'evd' solver if Numo::Linalg is loaded. Otherwise, it chooses the 'fpt' solver.
|
48
|
+
# 'fpt' uses the fixed-point algorithm.
|
49
|
+
# 'evd' performs eigen value decomposition of the covariance matrix of samples.
|
43
50
|
# @param max_iter [Integer] The maximum number of iterations. If solver = 'evd', this parameter is ignored.
|
44
51
|
# @param tol [Float] The tolerance of termination criterion. If solver = 'evd', this parameter is ignored.
|
45
52
|
# @param random_seed [Integer] The seed value using to initialize the random generator.
|
46
|
-
def initialize(n_components: 2, solver: '
|
53
|
+
def initialize(n_components: 2, solver: 'auto', max_iter: 100, tol: 1.0e-4, random_seed: nil)
|
47
54
|
check_params_numeric(n_components: n_components, max_iter: max_iter, tol: tol)
|
48
55
|
check_params_string(solver: solver)
|
49
56
|
check_params_numeric_or_nil(random_seed: random_seed)
|
50
57
|
check_params_positive(n_components: n_components, max_iter: max_iter, tol: tol)
|
51
58
|
@params = {}
|
52
|
-
@params[:solver] = solver
|
59
|
+
@params[:solver] = if solver == 'auto'
|
60
|
+
load_linalg? ? 'evd' : 'fpt'
|
61
|
+
else
|
62
|
+
solver != 'evd' ? 'fpt' : 'evd'
|
63
|
+
end
|
53
64
|
@params[:n_components] = n_components
|
54
65
|
@params[:max_iter] = max_iter
|
55
66
|
@params[:tol] = tol
|
@@ -128,6 +139,13 @@ module Rumale
|
|
128
139
|
|
129
140
|
private
|
130
141
|
|
142
|
+
def load_linalg?
|
143
|
+
return false if defined?(Numo::Linalg).nil?
|
144
|
+
return false if Numo::Linalg::VERSION < '0.1.4'
|
145
|
+
|
146
|
+
true
|
147
|
+
end
|
148
|
+
|
131
149
|
def orthogonalize(pcvec)
|
132
150
|
unless @components.nil?
|
133
151
|
delta = @components.dot(pcvec) * @components.transpose
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'mmh3'
|
4
3
|
require 'rumale/base/base_estimator'
|
5
4
|
require 'rumale/base/transformer'
|
6
5
|
|
@@ -11,11 +10,15 @@ module Rumale
|
|
11
10
|
# This encoder employs signed 32-bit Murmurhash3 as the hash function.
|
12
11
|
#
|
13
12
|
# @example
|
13
|
+
# require 'mmh3'
|
14
|
+
# require 'rumale'
|
15
|
+
#
|
14
16
|
# encoder = Rumale::FeatureExtraction::FeatureHasher.new(n_features: 10)
|
15
17
|
# x = encoder.transform([
|
16
18
|
# { dog: 1, cat: 2, elephant: 4 },
|
17
19
|
# { dog: 2, run: 5 }
|
18
20
|
# ])
|
21
|
+
#
|
19
22
|
# # > pp x
|
20
23
|
# # Numo::DFloat#shape=[2,10]
|
21
24
|
# # [[0, 0, -4, -1, 0, 0, 0, 0, 0, 2],
|
@@ -62,6 +65,8 @@ module Rumale
|
|
62
65
|
# @param x [Array<Hash>] (shape: [n_samples]) The array of hash consisting of feature names and values.
|
63
66
|
# @return [Numo::DFloat] (shape: [n_samples, n_features]) The encoded sample array.
|
64
67
|
def transform(x)
|
68
|
+
raise 'FeatureHasher#transform requires Mmh3 but that is not loaded.' unless enable_mmh3?
|
69
|
+
|
65
70
|
x = [x] unless x.is_a?(Array)
|
66
71
|
n_samples = x.size
|
67
72
|
|
@@ -85,6 +90,14 @@ module Rumale
|
|
85
90
|
|
86
91
|
private
|
87
92
|
|
93
|
+
def enable_mmh3?
|
94
|
+
if defined?(Mmh3).nil?
|
95
|
+
warn('FeatureHasher#transform requires Mmh3 but that is not loaded. You should intall and load mmh3 gem in advance.')
|
96
|
+
return false
|
97
|
+
end
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
88
101
|
def n_features
|
89
102
|
@params[:n_features]
|
90
103
|
end
|
@@ -8,6 +8,7 @@ module Rumale
|
|
8
8
|
# @note
|
9
9
|
# In version 0.17.0, a new linear model abstract class called BaseSGD is introduced.
|
10
10
|
# BaseLienarModel is deprecated and will be removed in the future.
|
11
|
+
# @deprecated Use BaseSGD class instead. This class will be deleted in version 0.20.0.
|
11
12
|
#
|
12
13
|
# BaseLinearModel is an abstract class for implementation of linear estimator
|
13
14
|
# with mini-batch stochastic gradient descent optimization.
|
@@ -2,13 +2,15 @@
|
|
2
2
|
|
3
3
|
require 'rumale/base/base_estimator'
|
4
4
|
require 'rumale/base/transformer'
|
5
|
-
require 'mopti/scaled_conjugate_gradient'
|
6
5
|
|
7
6
|
module Rumale
|
8
7
|
module MetricLearning
|
9
8
|
# NeighbourhoodComponentAnalysis is a class that implements Neighbourhood Component Analysis.
|
10
9
|
#
|
11
10
|
# @example
|
11
|
+
# require 'mopti'
|
12
|
+
# require 'rumale'
|
13
|
+
#
|
12
14
|
# transformer = Rumale::MetricLearning::NeighbourhoodComponentAnalysis.new
|
13
15
|
# transformer.fit(training_samples, traininig_labels)
|
14
16
|
# low_samples = transformer.transform(testing_samples)
|
@@ -63,6 +65,8 @@ module Rumale
|
|
63
65
|
# @param y [Numo::Int32] (shape: [n_samples]) The labels to be used for fitting the model.
|
64
66
|
# @return [NeighbourhoodComponentAnalysis] The learned classifier itself.
|
65
67
|
def fit(x, y)
|
68
|
+
raise 'NeighbourhoodComponentAnalysis#fit requires Mopti but that is not loaded.' unless enable_mopti?
|
69
|
+
|
66
70
|
x = check_convert_sample_array(x)
|
67
71
|
y = check_convert_label_array(y)
|
68
72
|
check_sample_label_size(x, y)
|
@@ -98,6 +102,14 @@ module Rumale
|
|
98
102
|
|
99
103
|
private
|
100
104
|
|
105
|
+
def enable_mopti?
|
106
|
+
if defined?(Mopti).nil?
|
107
|
+
warn('NeighbourhoodComponentAnalysis#fit requires Mopti but that is not loaded. You should intall and load mopti gem in advance.')
|
108
|
+
return false
|
109
|
+
end
|
110
|
+
true
|
111
|
+
end
|
112
|
+
|
101
113
|
def init_components(x, n_features, n_components)
|
102
114
|
if @params[:init] == 'pca'
|
103
115
|
pca = Rumale::Decomposition::PCA.new(n_components: n_components, solver: 'evd')
|
@@ -7,6 +7,8 @@ module Rumale
|
|
7
7
|
module Optimizer
|
8
8
|
# AdaGrad is a class that implements AdaGrad optimizer.
|
9
9
|
#
|
10
|
+
# @deprecated AdaGrad will be deleted in version 0.20.0.
|
11
|
+
#
|
10
12
|
# *Reference*
|
11
13
|
# - Duchi, J., Hazan, E., and Singer, Y., "Adaptive Subgradient Methods for Online Learning and Stochastic Optimization," J. Machine Learning Research, vol. 12, pp. 2121--2159, 2011.
|
12
14
|
class AdaGrad
|
@@ -17,6 +19,7 @@ module Rumale
|
|
17
19
|
#
|
18
20
|
# @param learning_rate [Float] The initial value of learning rate.
|
19
21
|
def initialize(learning_rate: 0.01)
|
22
|
+
warn 'warning: AdaGrad is deprecated. This class will be deleted in version 0.20.0.'
|
20
23
|
check_params_numeric(learning_rate: learning_rate)
|
21
24
|
check_params_positive(learning_rate: learning_rate)
|
22
25
|
@params = {}
|
@@ -7,6 +7,8 @@ module Rumale
|
|
7
7
|
module Optimizer
|
8
8
|
# Adam is a class that implements Adam optimizer.
|
9
9
|
#
|
10
|
+
# @deprecated Adam will be deleted in version 0.20.0.
|
11
|
+
#
|
10
12
|
# *Reference*
|
11
13
|
# - Kingma, D P., and Ba, J., "Adam: A Method for Stochastic Optimization," Proc. ICLR'15, 2015.
|
12
14
|
class Adam
|
@@ -19,6 +21,7 @@ module Rumale
|
|
19
21
|
# @param decay1 [Float] The smoothing parameter for the first moment.
|
20
22
|
# @param decay2 [Float] The smoothing parameter for the second moment.
|
21
23
|
def initialize(learning_rate: 0.001, decay1: 0.9, decay2: 0.999)
|
24
|
+
warn 'warning: Adam is deprecated. This class will be deleted in version 0.20.0.'
|
22
25
|
check_params_numeric(learning_rate: learning_rate, decay1: decay1, decay2: decay2)
|
23
26
|
check_params_positive(learning_rate: learning_rate, decay1: decay1, decay2: decay2)
|
24
27
|
@params = {}
|
@@ -5,9 +5,13 @@ require 'rumale/base/base_estimator'
|
|
5
5
|
|
6
6
|
module Rumale
|
7
7
|
# This module consists of the classes that implement optimizers adaptively tuning hyperparameters.
|
8
|
+
#
|
9
|
+
# @deprecated Optimizer module will be deleted in version 0.20.0.
|
8
10
|
module Optimizer
|
9
11
|
# Nadam is a class that implements Nadam optimizer.
|
10
12
|
#
|
13
|
+
# @deprecated Nadam will be deleted in version 0.20.0.
|
14
|
+
#
|
11
15
|
# *Reference*
|
12
16
|
# - Dozat, T., "Incorporating Nesterov Momentum into Adam," Tech. Repo. Stanford University, 2015.
|
13
17
|
class Nadam
|
@@ -20,6 +24,7 @@ module Rumale
|
|
20
24
|
# @param decay1 [Float] The smoothing parameter for the first moment.
|
21
25
|
# @param decay2 [Float] The smoothing parameter for the second moment.
|
22
26
|
def initialize(learning_rate: 0.01, decay1: 0.9, decay2: 0.999)
|
27
|
+
warn 'warning: Nadam is deprecated. This class will be deleted in version 0.20.0.'
|
23
28
|
check_params_numeric(learning_rate: learning_rate, decay1: decay1, decay2: decay2)
|
24
29
|
check_params_positive(learning_rate: learning_rate, decay1: decay1, decay2: decay2)
|
25
30
|
@params = {}
|
@@ -7,6 +7,8 @@ module Rumale
|
|
7
7
|
module Optimizer
|
8
8
|
# RMSProp is a class that implements RMSProp optimizer.
|
9
9
|
#
|
10
|
+
# @deprecated RMSProp will be deleted in version 0.20.0.
|
11
|
+
#
|
10
12
|
# *Reference*
|
11
13
|
# - Sutskever, I., Martens, J., Dahl, G., and Hinton, G., "On the importance of initialization and momentum in deep learning," Proc. ICML' 13, pp. 1139--1147, 2013.
|
12
14
|
# - Hinton, G., Srivastava, N., and Swersky, K., "Lecture 6e rmsprop," Neural Networks for Machine Learning, 2012.
|
@@ -20,6 +22,7 @@ module Rumale
|
|
20
22
|
# @param momentum [Float] The initial value of momentum.
|
21
23
|
# @param decay [Float] The smooting parameter.
|
22
24
|
def initialize(learning_rate: 0.01, momentum: 0.9, decay: 0.9)
|
25
|
+
warn 'warning: RMSProp is deprecated. This class will be deleted in version 0.20.0.'
|
23
26
|
check_params_numeric(learning_rate: learning_rate, momentum: momentum, decay: decay)
|
24
27
|
check_params_positive(learning_rate: learning_rate, momentum: momentum, decay: decay)
|
25
28
|
@params = {}
|
data/lib/rumale/optimizer/sgd.rb
CHANGED
@@ -6,6 +6,8 @@ require 'rumale/base/base_estimator'
|
|
6
6
|
module Rumale
|
7
7
|
module Optimizer
|
8
8
|
# SGD is a class that implements SGD optimizer.
|
9
|
+
#
|
10
|
+
# @deprecated SGD will be deleted in version 0.20.0.
|
9
11
|
class SGD
|
10
12
|
include Base::BaseEstimator
|
11
13
|
include Validation
|
@@ -16,6 +18,7 @@ module Rumale
|
|
16
18
|
# @param momentum [Float] The initial value of momentum.
|
17
19
|
# @param decay [Float] The smooting parameter.
|
18
20
|
def initialize(learning_rate: 0.01, momentum: 0.0, decay: 0.0)
|
21
|
+
warn 'warning: SGD is deprecated. This class will be deleted in version 0.20.0.'
|
19
22
|
check_params_numeric(learning_rate: learning_rate, momentum: momentum, decay: decay)
|
20
23
|
check_params_positive(learning_rate: learning_rate, momentum: momentum, decay: decay)
|
21
24
|
@params = {}
|
@@ -7,6 +7,8 @@ module Rumale
|
|
7
7
|
module Optimizer
|
8
8
|
# YellowFin is a class that implements YellowFin optimizer.
|
9
9
|
#
|
10
|
+
# @deprecated YellowFin will be deleted in version 0.20.0.
|
11
|
+
#
|
10
12
|
# *Reference*
|
11
13
|
# - Zhang, J., and Mitliagkas, I., "YellowFin and the Art of Momentum Tuning," CoRR abs/1706.03471, 2017.
|
12
14
|
class YellowFin
|
@@ -20,6 +22,7 @@ module Rumale
|
|
20
22
|
# @param decay [Float] The smooting parameter.
|
21
23
|
# @param window_width [Integer] The sliding window width for searching curvature range.
|
22
24
|
def initialize(learning_rate: 0.01, momentum: 0.9, decay: 0.999, window_width: 20)
|
25
|
+
warn 'warning: YellowFin is deprecated. This class will be deleted in version 0.20.0.'
|
23
26
|
check_params_numeric(learning_rate: learning_rate, momentum: momentum, decay: decay, window_width: window_width)
|
24
27
|
check_params_positive(learning_rate: learning_rate, momentum: momentum, decay: decay, window_width: window_width)
|
25
28
|
@params = {}
|
@@ -5,9 +5,13 @@ require 'rumale/optimizer/nadam'
|
|
5
5
|
|
6
6
|
module Rumale
|
7
7
|
# This module consists of the classes that implement polynomial models.
|
8
|
+
#
|
9
|
+
# @deprecated PolynomialModel module will be deleted in version 0.20.0.
|
8
10
|
module PolynomialModel
|
9
11
|
# BaseFactorizationMachine is an abstract class for implementation of Factorization Machine-based estimators.
|
10
12
|
# This class is used internally.
|
13
|
+
#
|
14
|
+
# @deprecated BaseFactorizationMachine will be deleted in version 0.20.0.
|
11
15
|
class BaseFactorizationMachine
|
12
16
|
include Base::BaseEstimator
|
13
17
|
|
@@ -10,6 +10,10 @@ module Rumale
|
|
10
10
|
# with stochastic gradient descent (SGD) optimization.
|
11
11
|
# For multiclass classification problem, it uses one-vs-the-rest strategy.
|
12
12
|
#
|
13
|
+
# @deprecated
|
14
|
+
# FactorizationMachineClassifier will be deleted in version 0.20.0.
|
15
|
+
# The Ruamle author recommends using the xlearn gem instead.
|
16
|
+
#
|
13
17
|
# @example
|
14
18
|
# estimator =
|
15
19
|
# Rumale::PolynomialModel::FactorizationMachineClassifier.new(
|
@@ -65,6 +69,7 @@ module Rumale
|
|
65
69
|
def initialize(n_factors: 2, loss: 'hinge', reg_param_linear: 1.0, reg_param_factor: 1.0,
|
66
70
|
max_iter: 200, batch_size: 50, tol: 1e-4,
|
67
71
|
optimizer: nil, n_jobs: nil, verbose: false, random_seed: nil)
|
72
|
+
warn 'warning: FactorizationMachineClassifier is deprecated. This class will be deleted in version 0.20.0.'
|
68
73
|
check_params_numeric(reg_param_linear: reg_param_linear, reg_param_factor: reg_param_factor,
|
69
74
|
n_factors: n_factors, max_iter: max_iter, batch_size: batch_size, tol: tol)
|
70
75
|
check_params_string(loss: loss)
|
@@ -8,6 +8,10 @@ module Rumale
|
|
8
8
|
# FactorizationMachineRegressor is a class that implements Factorization Machine
|
9
9
|
# with stochastic gradient descent (SGD) optimization.
|
10
10
|
#
|
11
|
+
# @deprecated
|
12
|
+
# FactorizationMachineRegressor will be deleted in version 0.20.0.
|
13
|
+
# The Ruamle author recommends using the xlearn gem instead.
|
14
|
+
#
|
11
15
|
# @example
|
12
16
|
# estimator =
|
13
17
|
# Rumale::PolynomialModel::FactorizationMachineRegressor.new(
|
@@ -58,6 +62,7 @@ module Rumale
|
|
58
62
|
def initialize(n_factors: 2, reg_param_linear: 1.0, reg_param_factor: 1.0,
|
59
63
|
max_iter: 200, batch_size: 50, tol: 1e-4,
|
60
64
|
optimizer: nil, n_jobs: nil, verbose: false, random_seed: nil)
|
65
|
+
warn 'warning: FactorizationMachineClassifier is deprecated. This class will be deleted in version 0.20.0.'
|
61
66
|
check_params_numeric(reg_param_linear: reg_param_linear, reg_param_factor: reg_param_factor,
|
62
67
|
n_factors: n_factors, max_iter: max_iter, batch_size: batch_size, tol: tol)
|
63
68
|
check_params_boolean(verbose: verbose)
|
data/lib/rumale/version.rb
CHANGED
data/rumale.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
Rumale is a machine learning library in Ruby.
|
17
17
|
Rumale provides machine learning algorithms with interfaces similar to Scikit-Learn in Python.
|
18
18
|
Rumale supports Support Vector Machine,
|
19
|
-
Logistic Regression, Ridge, Lasso,
|
19
|
+
Logistic Regression, Ridge, Lasso,
|
20
20
|
Multi-layer Perceptron,
|
21
21
|
Naive Bayes, Decision Tree, Gradient Tree Boosting, Random Forest,
|
22
22
|
K-Means, Gaussian Mixture Model, DBSCAN, Spectral Clustering,
|
@@ -45,6 +45,4 @@ Gem::Specification.new do |spec|
|
|
45
45
|
}
|
46
46
|
|
47
47
|
spec.add_runtime_dependency 'numo-narray', '>= 0.9.1'
|
48
|
-
spec.add_runtime_dependency 'mopti', '>= 0.1.0'
|
49
|
-
spec.add_runtime_dependency 'mmh3', '>= 0.1.0'
|
50
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rumale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|
@@ -24,39 +24,11 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.9.1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: mopti
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: mmh3
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.0
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.0
|
55
27
|
description: |
|
56
28
|
Rumale is a machine learning library in Ruby.
|
57
29
|
Rumale provides machine learning algorithms with interfaces similar to Scikit-Learn in Python.
|
58
30
|
Rumale supports Support Vector Machine,
|
59
|
-
Logistic Regression, Ridge, Lasso,
|
31
|
+
Logistic Regression, Ridge, Lasso,
|
60
32
|
Multi-layer Perceptron,
|
61
33
|
Naive Bayes, Decision Tree, Gradient Tree Boosting, Random Forest,
|
62
34
|
K-Means, Gaussian Mixture Model, DBSCAN, Spectral Clustering,
|