newral 0.1 → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9047684d474438632d4eab4774fbb7b9debecc5
|
4
|
+
data.tar.gz: 0d83a2232560366d75af79b848fbbb8ba358169d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27e1bca6445adcc1d518d898e2e0e027d0d573eaba8bae588a9350a6d676d285afa549a9bc2a1ac07019f44645dc6cf8516b389069f50bf03ff8c3b322a0b0ea
|
7
|
+
data.tar.gz: 505f5faa6a843b4b5ab9e2c6654f6a8c32aa692bcf73d5058f95b3167a30c649979f250bbb17720d119e06a4aae5a4224a6d40ee53931607ca5caca3a061f9ed
|
data/README.md
CHANGED
@@ -9,7 +9,13 @@ In the implementation I tried to write as little code as possible and used class
|
|
9
9
|
So the data structures are in no way tuned for efficiency, rather I tried to make clear what actually is going on.
|
10
10
|
For every concept there should be at least one test to show it in action.
|
11
11
|
|
12
|
+
## Install
|
12
13
|
|
14
|
+
```ruby
|
15
|
+
gem install newral
|
16
|
+
```
|
17
|
+
|
18
|
+
## What it does
|
13
19
|
Everything is still quite early stages but there are a lot of things you can do already
|
14
20
|
|
15
21
|
* Training Functions
|
@@ -167,13 +173,13 @@ data = Newral::Data::Csv.new(file_name:File.expand_path('../test/fixtures/IRIS.c
|
|
167
173
|
data.process
|
168
174
|
|
169
175
|
network = Newral::Networks::BackpropagationNetwork.new( number_of_inputs: data.inputs.first.size, number_of_hidden: data.inputs.first.size, number_of_outputs: data.output_hash.keys.size )
|
170
|
-
network.calculate_error( input: data.sub_set(set: :inputs, category: :validation ), output: data.output_as_vector( category: :
|
176
|
+
network.calculate_error( input: data.sub_set(set: :inputs, category: :validation ), output: data.output_as_vector( category: :validation ) )
|
171
177
|
|
172
178
|
100.times do
|
173
179
|
network.train( input: data.sub_set(set: :inputs, category: :training ), output: data.output_as_vector( category: :training ) )
|
174
180
|
end
|
175
181
|
|
176
|
-
network.calculate_error( input: data.sub_set(set: :inputs, category: :validation ), output: data.output_as_vector( category: :
|
182
|
+
network.calculate_error( input: data.sub_set(set: :inputs, category: :validation ), output: data.output_as_vector( category: :validation ) )
|
177
183
|
|
178
184
|
```
|
179
185
|
|
@@ -186,7 +192,7 @@ data.process
|
|
186
192
|
sample_data = data.sample( limit:100 )
|
187
193
|
sample_data.downsample_input!( width:2,height:2,width_of_line:28 ) # create less resolution pictures
|
188
194
|
|
189
|
-
sample_data2 = data.sample( limit:100, offset:100 ) # a
|
195
|
+
sample_data2 = data.sample( limit:100, offset:100 ) # a 2nd sample
|
190
196
|
sample_data2.downsample_input!( width:2,height:2,width_of_line:28 )
|
191
197
|
|
192
198
|
|
@@ -252,7 +258,7 @@ f.calculate 2 # 2*(2**2)+5*2+1 => 19
|
|
252
258
|
first lets use a basic polynominal function
|
253
259
|
```ruby
|
254
260
|
input = [2,4,8]
|
255
|
-
output = [4,16,64] # best function is x**2, lets see if our training algorithms
|
261
|
+
output = [4,16,64] # best function is x**2, lets see if our training algorithms finds them
|
256
262
|
g=Newral::Training::Greedy.new( input: input, output: output, klass: Newral::Functions::Polynomial )
|
257
263
|
g.process
|
258
264
|
g.best_function.calculate_error( input: input, output: output )
|