ruby_brain 0.1.1 → 0.1.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
  SHA1:
3
- metadata.gz: e1b359c7dfcb72a2c865c0eb3132d795a14e865b
4
- data.tar.gz: cf67ab8cb83e45351d9436b739851813e42dcf27
3
+ metadata.gz: 1d16336a36fad90976a76d33b16603a900db1c78
4
+ data.tar.gz: 7b50c39268aff62b7a24f29391c0055ea93ccde4
5
5
  SHA512:
6
- metadata.gz: d2f45afd551e3695dd6661bf68d769d40705ca7b0195156fbc6aaec61ccb796511a8b143439c2e109c867ef3dfaf485ac403bb48e350c4b0b28d96c98568a11d
7
- data.tar.gz: 1490f842fd47da4290fff7158bdb72c987ff946b02a3f3ccf9feace7ef21fdfb2cb55a11b3dc4c798af52aa1836f27303d067f95918dd35d9b2395dac0b017c7
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
- # 3 units in a hidden layer
75
+ # 5 units in a hidden layer
76
76
  # 1 output
77
- [2, 3, 1]
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, 3, 1])
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 the code. Sorry for missing document.
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=100, tolerance=0.0004, monitoring_channels=[:best_params_training])
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, 3, 1])
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 array =dataset=.
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.
@@ -1,3 +1,3 @@
1
1
  module RubyBrain
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -60,7 +60,7 @@ module RubyBrain
60
60
  YAML.dump(@w_3d, f)
61
61
  end
62
62
  end
63
- # @w_3d.to_yaml
63
+ # # @w_3d.to_yaml
64
64
  end
65
65
 
66
66
  def load_from_yaml_file(yaml_file)
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{Neural Net, Deep Learning implement for Ruby}
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.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-27 00:00:00.000000000 Z
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: Neural Net, Deep Learning implement for Ruby
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: []