ruby_brain 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.org +18 -7
- data/lib/ruby_brain/version.rb +1 -1
- data/lib/ruby_brain/weights.rb +1 -1
- data/ruby_brain.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d16336a36fad90976a76d33b16603a900db1c78
|
4
|
+
data.tar.gz: 7b50c39268aff62b7a24f29391c0055ea93ccde4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 458f807eb9510b6e9bf5c8d2aee584490c27348733d020c7446ff38970fe35516e25503327d837dc033341ae19623062daf2284ad8216fb7320497b1f423a8a2
|
7
|
+
data.tar.gz: 5a36ef020a068c7a7f8cbc5476ae93f8f02bdb4afa366aead3ac402d476560158ee62a1c70e1845913252e0bc2d1f4f07dd30f160d2d3b931a7ad82f0f108df2
|
data/README.org
CHANGED
@@ -72,9 +72,9 @@
|
|
72
72
|
If we use 1 hidden layer which has 3 neurons for above "AND operator" example, following array indicates the structure.
|
73
73
|
#+BEGIN_SRC ruby
|
74
74
|
# 2 inputs
|
75
|
-
#
|
75
|
+
# 5 units in a hidden layer
|
76
76
|
# 1 output
|
77
|
-
[2,
|
77
|
+
[2, 5, 1]
|
78
78
|
#+END_SRC
|
79
79
|
|
80
80
|
You can use 2 hidden layers with following code.
|
@@ -88,7 +88,7 @@
|
|
88
88
|
|
89
89
|
So, a netowrk is created by
|
90
90
|
#+BEGIN_SRC ruby
|
91
|
-
a_network = RubyBrain::Network.new([2,
|
91
|
+
a_network = RubyBrain::Network.new([2, 5, 1])
|
92
92
|
|
93
93
|
# learning_rate can be set
|
94
94
|
a_network.learning_rate = 0.5
|
@@ -98,7 +98,7 @@
|
|
98
98
|
#+END_SRC
|
99
99
|
|
100
100
|
There are other options for the constructor.
|
101
|
-
Please refer to
|
101
|
+
Please refer to [[http://www.rubydoc.info/github/elgoog/ruby_brain/master/RubyBrain%252FNetwork%253Alearn][Network#learn document]]
|
102
102
|
|
103
103
|
** training
|
104
104
|
|
@@ -107,7 +107,7 @@
|
|
107
107
|
#+BEGIN_SRC ruby
|
108
108
|
# max_training_cout : max epoch
|
109
109
|
# tolerance : stop training if RMS error become smaller than this value.
|
110
|
-
a_network.learn(training_input_set, training_supervisor_set, max_training_count=
|
110
|
+
a_network.learn(training_input_set, training_supervisor_set, max_training_count=3000, tolerance=0.0004, monitoring_channels=[:best_params_training])
|
111
111
|
#+END_SRC
|
112
112
|
|
113
113
|
** predicate
|
@@ -131,7 +131,7 @@
|
|
131
131
|
|
132
132
|
Optimized weights can be saved into a YAML file and you can use it for initializing weights when you create a new network.
|
133
133
|
#+BEGIN_SRC ruby
|
134
|
-
a_network = RubyBrain::Network.new([2,
|
134
|
+
a_network = RubyBrain::Network.new([2, 5, 1])
|
135
135
|
a_network.init_network
|
136
136
|
a_network.load_weights_from_yaml_file('/path/to/saved/weights/file.yml')
|
137
137
|
#+END_SRC
|
@@ -149,10 +149,21 @@
|
|
149
149
|
#+END_SRC
|
150
150
|
|
151
151
|
Get MNIST dataset from [[http://yann.lecun.com/exdb/mnist/][THE MNIST DATABASE of handwritten digits]] if the dataset files don't exist in the working directory.
|
152
|
-
And load them into Ruby
|
152
|
+
And load them into Ruby dictionary =dataset=.
|
153
153
|
|
154
154
|
#+BEGIN_SRC ruby
|
155
155
|
dataset = RubyBrain::DataSet::Mnist::data
|
156
|
+
|
157
|
+
# dataset has :input and :output dataset
|
158
|
+
dataset.keys # => [:input, :output]
|
159
|
+
|
160
|
+
# :input dataset has 60000(samples) x 784(28 * 28 input pixcels)
|
161
|
+
dataset[:input].size # => 60000
|
162
|
+
dataset[:input].first.size # => 784
|
163
|
+
|
164
|
+
# :output dataset has 60000(samples) x 10(classes 0~9)
|
165
|
+
dataset[:output].size # => 60000
|
166
|
+
dataset[:output].first.size # => 10
|
156
167
|
#+END_SRC
|
157
168
|
|
158
169
|
Divide =dataset= into training and test data.
|
data/lib/ruby_brain/version.rb
CHANGED
data/lib/ruby_brain/weights.rb
CHANGED
data/ruby_brain.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["elgoog"]
|
10
10
|
spec.email = ["elgoog.development@gmail.com"]
|
11
11
|
spec.summary = %q{NeuralNet/DeepLearning implement for Ruby}
|
12
|
-
spec.description = %q{
|
12
|
+
spec.description = %q{NeuralNet/DeepLearning implement for Ruby. You can use 'neural network' and 'deep learning' easily.}
|
13
13
|
spec.homepage = "https://github.com/elgoog/ruby_brain/"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_brain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- elgoog
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description: NeuralNet/DeepLearning implement for Ruby. You can use 'neural network'
|
70
|
+
and 'deep learning' easily.
|
70
71
|
email:
|
71
72
|
- elgoog.development@gmail.com
|
72
73
|
executables: []
|