ruby-fann 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/ext/ruby_fann/neural_network.c +968 -954
- data/lib/ruby_fann/version.rb +1 -1
- data/neurotica1.png +0 -0
- data/neurotica2.vrml +34 -34
- data/website/index.html +11 -14
- data/website/index.txt +10 -9
- data/xor_cascade.net +2 -2
- data/xor_float.net +1 -1
- metadata +3 -3
data/lib/ruby_fann/version.rb
CHANGED
data/neurotica1.png
CHANGED
Binary file
|
data/neurotica2.vrml
CHANGED
@@ -4,10 +4,10 @@ Group { children [
|
|
4
4
|
scale 0.028 0.028 0.028
|
5
5
|
children [
|
6
6
|
Background { skyColor 1.000 1.000 1.000 }
|
7
|
-
# node
|
7
|
+
# node 2159389060
|
8
8
|
Transform {
|
9
|
-
translation 6.000
|
10
|
-
scale
|
9
|
+
translation 6.000 47.000 0.000
|
10
|
+
scale 1.800 1.800 1.800
|
11
11
|
children [
|
12
12
|
Transform {
|
13
13
|
children [
|
@@ -24,10 +24,10 @@ Transform {
|
|
24
24
|
}
|
25
25
|
]
|
26
26
|
}
|
27
|
-
# node
|
27
|
+
# node 2159388180
|
28
28
|
Transform {
|
29
|
-
translation 50.000
|
30
|
-
scale
|
29
|
+
translation 50.000 7.000 0.000
|
30
|
+
scale 1.800 1.800 1.800
|
31
31
|
children [
|
32
32
|
Transform {
|
33
33
|
children [
|
@@ -44,14 +44,14 @@ Transform {
|
|
44
44
|
}
|
45
45
|
]
|
46
46
|
}
|
47
|
-
# edge
|
47
|
+
# edge 2159389060 -> 2159388180
|
48
48
|
Group { children [
|
49
49
|
Transform {
|
50
50
|
children [
|
51
51
|
Shape {
|
52
52
|
geometry Cylinder {
|
53
53
|
bottom FALSE top FALSE
|
54
|
-
height 38.
|
54
|
+
height 38.577 radius 1.000 }
|
55
55
|
appearance Appearance {
|
56
56
|
material Material {
|
57
57
|
ambientIntensity 0.33
|
@@ -60,7 +60,7 @@ Transform {
|
|
60
60
|
}
|
61
61
|
}
|
62
62
|
Transform {
|
63
|
-
translation 0 24.
|
63
|
+
translation 0 24.288 0
|
64
64
|
children [
|
65
65
|
Shape {
|
66
66
|
geometry Cone {bottomRadius 3.500 height 10.000 }
|
@@ -79,10 +79,10 @@ Transform {
|
|
79
79
|
translation 24.000 17.000 0.000
|
80
80
|
}
|
81
81
|
] }
|
82
|
-
# node
|
82
|
+
# node 2159388580
|
83
83
|
Transform {
|
84
|
-
translation 28.000
|
85
|
-
scale
|
84
|
+
translation 28.000 47.000 0.000
|
85
|
+
scale 1.800 1.800 1.800
|
86
86
|
children [
|
87
87
|
Transform {
|
88
88
|
children [
|
@@ -99,14 +99,14 @@ Transform {
|
|
99
99
|
}
|
100
100
|
]
|
101
101
|
}
|
102
|
-
# edge
|
102
|
+
# edge 2159388580 -> 2159388180
|
103
103
|
Group { children [
|
104
104
|
Transform {
|
105
105
|
children [
|
106
106
|
Shape {
|
107
107
|
geometry Cylinder {
|
108
108
|
bottom FALSE top FALSE
|
109
|
-
height
|
109
|
+
height 24.184 radius 1.000 }
|
110
110
|
appearance Appearance {
|
111
111
|
material Material {
|
112
112
|
ambientIntensity 0.33
|
@@ -115,7 +115,7 @@ Transform {
|
|
115
115
|
}
|
116
116
|
}
|
117
117
|
Transform {
|
118
|
-
translation 0 17.
|
118
|
+
translation 0 17.092 0
|
119
119
|
children [
|
120
120
|
Shape {
|
121
121
|
geometry Cone {bottomRadius 3.500 height 10.000 }
|
@@ -134,10 +134,10 @@ Transform {
|
|
134
134
|
translation 35.000 17.000 0.000
|
135
135
|
}
|
136
136
|
] }
|
137
|
-
# node
|
137
|
+
# node 2159388480
|
138
138
|
Transform {
|
139
|
-
translation 50.000
|
140
|
-
scale
|
139
|
+
translation 50.000 47.000 0.000
|
140
|
+
scale 1.800 1.800 1.800
|
141
141
|
children [
|
142
142
|
Transform {
|
143
143
|
children [
|
@@ -154,14 +154,14 @@ Transform {
|
|
154
154
|
}
|
155
155
|
]
|
156
156
|
}
|
157
|
-
# edge
|
157
|
+
# edge 2159388480 -> 2159388180
|
158
158
|
Group { children [
|
159
159
|
Transform {
|
160
160
|
children [
|
161
161
|
Shape {
|
162
162
|
geometry Cylinder {
|
163
163
|
bottom FALSE top FALSE
|
164
|
-
height
|
164
|
+
height 17.447 radius 1.000 }
|
165
165
|
appearance Appearance {
|
166
166
|
material Material {
|
167
167
|
ambientIntensity 0.33
|
@@ -170,7 +170,7 @@ Transform {
|
|
170
170
|
}
|
171
171
|
}
|
172
172
|
Transform {
|
173
|
-
translation 0
|
173
|
+
translation 0 13.724 0
|
174
174
|
children [
|
175
175
|
Shape {
|
176
176
|
geometry Cone {bottomRadius 3.500 height 10.000 }
|
@@ -189,10 +189,10 @@ Transform {
|
|
189
189
|
translation 46.000 17.000 0.000
|
190
190
|
}
|
191
191
|
] }
|
192
|
-
# node
|
192
|
+
# node 2159388380
|
193
193
|
Transform {
|
194
|
-
translation 72.000
|
195
|
-
scale
|
194
|
+
translation 72.000 47.000 0.000
|
195
|
+
scale 1.800 1.800 1.800
|
196
196
|
children [
|
197
197
|
Transform {
|
198
198
|
children [
|
@@ -209,14 +209,14 @@ Transform {
|
|
209
209
|
}
|
210
210
|
]
|
211
211
|
}
|
212
|
-
# edge
|
212
|
+
# edge 2159388380 -> 2159388180
|
213
213
|
Group { children [
|
214
214
|
Transform {
|
215
215
|
children [
|
216
216
|
Shape {
|
217
217
|
geometry Cylinder {
|
218
218
|
bottom FALSE top FALSE
|
219
|
-
height
|
219
|
+
height 22.918 radius 1.000 }
|
220
220
|
appearance Appearance {
|
221
221
|
material Material {
|
222
222
|
ambientIntensity 0.33
|
@@ -225,7 +225,7 @@ Transform {
|
|
225
225
|
}
|
226
226
|
}
|
227
227
|
Transform {
|
228
|
-
translation 0
|
228
|
+
translation 0 16.459 0
|
229
229
|
children [
|
230
230
|
Shape {
|
231
231
|
geometry Cone {bottomRadius 3.500 height 10.000 }
|
@@ -244,10 +244,10 @@ Transform {
|
|
244
244
|
translation 57.000 17.000 0.000
|
245
245
|
}
|
246
246
|
] }
|
247
|
-
# node
|
247
|
+
# node 2159388280
|
248
248
|
Transform {
|
249
|
-
translation 94.000
|
250
|
-
scale
|
249
|
+
translation 94.000 47.000 0.000
|
250
|
+
scale 1.800 1.800 1.800
|
251
251
|
children [
|
252
252
|
Transform {
|
253
253
|
children [
|
@@ -264,14 +264,14 @@ Transform {
|
|
264
264
|
}
|
265
265
|
]
|
266
266
|
}
|
267
|
-
# edge
|
267
|
+
# edge 2159388280 -> 2159388180
|
268
268
|
Group { children [
|
269
269
|
Transform {
|
270
270
|
children [
|
271
271
|
Shape {
|
272
272
|
geometry Cylinder {
|
273
273
|
bottom FALSE top FALSE
|
274
|
-
height
|
274
|
+
height 36.258 radius 1.000 }
|
275
275
|
appearance Appearance {
|
276
276
|
material Material {
|
277
277
|
ambientIntensity 0.33
|
@@ -280,7 +280,7 @@ Transform {
|
|
280
280
|
}
|
281
281
|
}
|
282
282
|
Transform {
|
283
|
-
translation 0 23.
|
283
|
+
translation 0 23.129 0
|
284
284
|
children [
|
285
285
|
Shape {
|
286
286
|
geometry Cone {bottomRadius 3.500 height 10.000 }
|
@@ -300,5 +300,5 @@ Transform {
|
|
300
300
|
}
|
301
301
|
] }
|
302
302
|
] }
|
303
|
-
Viewpoint {position 1.852 0.963
|
303
|
+
Viewpoint {position 1.852 0.963 5.961}
|
304
304
|
] }
|
data/website/index.html
CHANGED
@@ -40,26 +40,23 @@
|
|
40
40
|
<p>Get your documentation here: <a href="http://ruby-fann.rubyforge.org/rdoc">Docs</a></p>
|
41
41
|
<h2>Installing</h2>
|
42
42
|
<ul>
|
43
|
-
<li>First, Go here &
|
43
|
+
<li>First, Go here & read about <span class="caps">FANN</span>. It is no longer required for the gem, but understanding <span class="caps">FANN</span> will help with understanding the ruby-fann gem:</li>
|
44
44
|
</ul>
|
45
45
|
<a href="http://leenissen.dk/fann/">http://leenissen.dk/fann/</a>
|
46
|
+
|
46
47
|
<ul>
|
47
|
-
<li>
|
48
|
+
<li>Install ruby-fann:<br />
|
48
49
|
<pre class='syntax'><span class="punct">[</span><span class="ident">sudo</span><span class="punct">]</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">ruby</span><span class="punct">-</span><span class="ident">fann</span></pre></li>
|
49
50
|
</ul>
|
50
|
-
<
|
51
|
-
|
52
|
-
<pre class='syntax'><span class="ident">sudo</span> <span class="ident">env</span> <span class="constant">ARCHFLAGS</span><span class="punct">="</span><span class="string">-arch i386</span><span class="punct">"</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">ruby</span><span class="punct">-</span><span class="ident">fann</span></pre></li>
|
53
|
-
</ul>
|
51
|
+
<p>Some Mac OS X users (possibly that are using, or have used, MacPorts) need to set <span class="caps">ARCHFLAGS</span> in front of the install command:<br />
|
52
|
+
<pre class='syntax'><span class="ident">sudo</span> <span class="ident">env</span> <span class="constant">ARCHFLAGS</span><span class="punct">="</span><span class="string">-arch i386</span><span class="punct">"</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">ruby</span><span class="punct">-</span><span class="ident">fann</span></pre></p>
|
54
53
|
<h2>Requirements:</h2>
|
55
54
|
<ul>
|
56
|
-
<li>Fann 2.1 or greater (preferably in /usr/local/lib).</li>
|
57
55
|
<li>Ruby 1.8.6 or greater. Windows Ruby should be built natively in Cygwin/MingW. The OneClick installer seems to have problems with any gem that has a native component.</li>
|
58
|
-
<li>gnu make tools or
|
59
|
-
<li>graphviz and ruby-graphviz
|
60
|
-
<br />
|
61
|
-
h2. Unit Tests</li>
|
56
|
+
<li>gnu make tools or equivalent for native code in ext (tested on linux, mac os x, and windows with <a href="http://www.cygwin.com/">Cygwin</a>).</li>
|
57
|
+
<li>graphviz and ruby-graphviz are required for experimental <a href="http://ruby-fann.rubyforge.org/rdoc/classes/RubyFann/Neurotica.html">Neurotica</a> (<em>experimental</em>) graphical output.</li>
|
62
58
|
</ul>
|
59
|
+
<h2>Unit Tests:</h2>
|
63
60
|
<p>ruby-fann Gem has full complement of unit tests that are executed before the gem is deployed/redeployed to RubyForge.</p>
|
64
61
|
<h2>Demonstration of usage</h2>
|
65
62
|
<p><pre class='syntax'>
|
@@ -83,9 +80,9 @@ h2. Unit Tests</li>
|
|
83
80
|
<span class="comment"># Run with different input data:</span>
|
84
81
|
<span class="ident">outputs</span> <span class="punct">=</span> <span class="ident">fann</span><span class="punct">.</span><span class="ident">run</span><span class="punct">([</span><span class="number">0.7</span><span class="punct">,</span> <span class="number">0.9</span><span class="punct">,</span> <span class="number">0.2</span><span class="punct">])</span>
|
85
82
|
</pre></p>
|
86
|
-
<h2>
|
83
|
+
<h2>Implementing a callback method:</h2>
|
87
84
|
<p>This callback function can be called during training when using train_on_data, train_on_file or cascadetrain_on_data.</p>
|
88
|
-
<p>It is very useful for doing custom things during training. It is recommended to use this function when implementing custom training procedures, or when visualizing the training in a <span class="caps">GUI</span> etc. The args which the callback function takes
|
85
|
+
<p>It is very useful for doing custom things during training. It is recommended to use this function when implementing custom training procedures, or when visualizing the training in a <span class="caps">GUI</span> etc. The args which the callback function takes are the parameters given to the train_on_data, plus an epochs parameter which tells how many epochs the training have taken so far.</p>
|
89
86
|
<p>The callback method should return an integer, if the callback function returns -1, the training will terminate.</p>
|
90
87
|
<p>The callback (training_callback) will be automatically called if it is implemented on your subclass as follows:</p>
|
91
88
|
<pre>
|
@@ -106,7 +103,7 @@ end
|
|
106
103
|
<h2>Contact</h2>
|
107
104
|
<p>Comments are welcome. Send an email to <a href="mailto:steven@7bpeople.com">Steven Miers</a> email via the <a href="http://groups.google.com/group/ruby_fann">forum</a></p>
|
108
105
|
<p class="coda">
|
109
|
-
<a href="steven@7bpeople.com">Steven Miers</a>,
|
106
|
+
<a href="steven@7bpeople.com">Steven Miers</a>, 23rd December 2009<br>
|
110
107
|
</p>
|
111
108
|
</div>
|
112
109
|
|
data/website/index.txt
CHANGED
@@ -8,27 +8,28 @@ Get your documentation here: "Docs":http://ruby-fann.rubyforge.org/rdoc
|
|
8
8
|
|
9
9
|
h2. Installing
|
10
10
|
|
11
|
-
* First, Go here &
|
11
|
+
* First, Go here & read about FANN. It is no longer required for the gem, but understanding FANN will help with understanding the ruby-fann gem:
|
12
12
|
|
13
13
|
"http://leenissen.dk/fann/":http://leenissen.dk/fann/
|
14
|
-
|
14
|
+
|
15
|
+
* Install ruby-fann:
|
15
16
|
<pre syntax="ruby">[sudo] gem install ruby-fann</pre>
|
16
17
|
|
17
|
-
|
18
|
+
Some Mac OS X users (possibly that are using, or have used, MacPorts) need to set ARCHFLAGS in front of the install command:
|
18
19
|
<pre syntax="ruby">sudo env ARCHFLAGS="-arch i386" gem install ruby-fann</pre>
|
19
20
|
|
20
21
|
h2. Requirements:
|
21
22
|
|
22
|
-
* Fann 2.1 or greater (preferably in /usr/local/lib).
|
23
23
|
* Ruby 1.8.6 or greater. Windows Ruby should be built natively in Cygwin/MingW. The OneClick installer seems to have problems with any gem that has a native component.
|
24
|
-
* gnu make tools or
|
25
|
-
* graphviz and ruby-graphviz
|
24
|
+
* gnu make tools or equivalent for native code in ext (tested on linux, mac os x, and windows with "Cygwin":http://www.cygwin.com/).
|
25
|
+
* graphviz and ruby-graphviz are required for experimental "Neurotica":http://ruby-fann.rubyforge.org/rdoc/classes/RubyFann/Neurotica.html (_experimental_) graphical output.
|
26
26
|
|
27
|
-
h2. Unit Tests
|
27
|
+
h2. Unit Tests:
|
28
28
|
|
29
29
|
ruby-fann Gem has full complement of unit tests that are executed before the gem is deployed/redeployed to RubyForge.
|
30
30
|
|
31
31
|
h2. Demonstration of usage
|
32
|
+
_Note: this example was segfaulting in IRB, but not when run as a regular ruby program. That has been fixed._
|
32
33
|
|
33
34
|
<pre syntax="ruby">
|
34
35
|
require 'rubygems'
|
@@ -52,11 +53,11 @@ fann.train_on_data(training_data, 1000, 1, 0.1)
|
|
52
53
|
outputs = fann.run([0.7, 0.9, 0.2])
|
53
54
|
</pre>
|
54
55
|
|
55
|
-
h2.
|
56
|
+
h2. Implementing a callback method:
|
56
57
|
|
57
58
|
This callback function can be called during training when using train_on_data, train_on_file or cascadetrain_on_data.
|
58
59
|
|
59
|
-
It is very useful for doing custom things during training. It is recommended to use this function when implementing custom training procedures, or when visualizing the training in a GUI etc. The args which the callback function takes
|
60
|
+
It is very useful for doing custom things during training. It is recommended to use this function when implementing custom training procedures, or when visualizing the training in a GUI etc. The args which the callback function takes are the parameters given to the train_on_data, plus an epochs parameter which tells how many epochs the training have taken so far.
|
60
61
|
|
61
62
|
The callback method should return an integer, if the callback function returns -1, the training will terminate.
|
62
63
|
|
data/xor_cascade.net
CHANGED
@@ -30,5 +30,5 @@ cascade_activation_steepnesses_count=4
|
|
30
30
|
cascade_activation_steepnesses=2.50000000000000000000e-01 5.00000000000000000000e-01 7.50000000000000000000e-01 1.00000000000000000000e+00
|
31
31
|
layer_sizes=3 1 1 1
|
32
32
|
scale_included=0
|
33
|
-
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (3, 8, 5.00000000000000000000e-01) (4,
|
34
|
-
connections (connected_to_neuron, weight)=(0,
|
33
|
+
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (3, 8, 5.00000000000000000000e-01) (4, 7, 7.50000000000000000000e-01) (5, 5, 5.00000000000000000000e-01)
|
34
|
+
connections (connected_to_neuron, weight)=(0, 2.03369093040802306760e+00) (1, 1.91930347509465915046e+00) (2, 2.68446253873775353416e-01) (0, -5.26866552139089794338e+00) (1, 4.23321787395280768607e+00) (2, -4.54275397511101708403e+00) (3, 4.56107898673613831875e+00) (0, 1.16525213056803722544e+00) (1, 2.54353376362498828644e-01) (2, -1.71142298268632808700e-01) (3, 4.01179525668330754229e+01) (4, -1.40854438232682288579e-01)
|
data/xor_float.net
CHANGED
@@ -31,4 +31,4 @@ cascade_activation_steepnesses=2.50000000000000000000e-01 5.00000000000000000000
|
|
31
31
|
layer_sizes=3 4 2
|
32
32
|
scale_included=0
|
33
33
|
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (3, 5, 1.00000000000000000000e+00) (3, 5, 1.00000000000000000000e+00) (3, 5, 1.00000000000000000000e+00) (0, 5, 1.00000000000000000000e+00) (4, 5, 1.00000000000000000000e+00) (0, 5, 1.00000000000000000000e+00)
|
34
|
-
connections (connected_to_neuron, weight)=(0, 2.
|
34
|
+
connections (connected_to_neuron, weight)=(0, 2.17194810071245480998e+00) (1, 2.19810309367494838284e+00) (2, 2.07433761000328864554e+00) (0, 1.95411305220244946312e+00) (1, 1.94975822360003725464e+00) (2, -1.79330464954490631513e+00) (0, 4.23026595247278647260e-02) (1, 6.06086565778331601284e-03) (2, -9.86690112483247450115e-01) (3, 4.20699256351337425031e+00) (4, -4.34365507923527793821e+00) (5, 3.03271554955518274355e+00) (6, -1.68677741705357742141e+00)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-fann
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Miers
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-24 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.
|
23
|
+
version: 2.4.0
|
24
24
|
version:
|
25
25
|
description: Bindings to use FANN from within ruby/rails environment.
|
26
26
|
email: steven@7bpeople.com
|