ruby-fann 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -7,3 +7,8 @@
7
7
 
8
8
  * 1 major enhancement:
9
9
  * Include docs
10
+
11
+ == 0.7.3 2007-12-19
12
+
13
+ * 1 minor enhancement
14
+ * Directives to build native extensions
data/Manifest.txt CHANGED
@@ -5,14 +5,17 @@ README.txt
5
5
  Rakefile
6
6
  config/hoe.rb
7
7
  config/requirements.rb
8
- doc
8
+ ext/ruby_fann/MANIFEST
9
+ ext/ruby_fann/Makefile
9
10
  ext/ruby_fann/extconf.rb
10
11
  ext/ruby_fann/fann_augment.h
11
12
  ext/ruby_fann/neural_network.c
12
13
  lib/ruby_fann.rb
13
- lib/ruby_fann/version.rb
14
14
  lib/ruby_fann/neurotica.rb
15
+ lib/ruby_fann/version.rb
15
16
  log/debug.log
17
+ neurotica1.png
18
+ neurotica2.vrml
16
19
  script/destroy
17
20
  script/generate
18
21
  script/txt2html
@@ -20,10 +23,17 @@ setup.rb
20
23
  tasks/deployment.rake
21
24
  tasks/environment.rake
22
25
  tasks/website.rake
26
+ test/test.train
23
27
  test/test_helper.rb
28
+ test/test_neurotica.rb
24
29
  test/test_ruby_fann.rb
30
+ test/test_ruby_fann_functional.rb
31
+ verify.train
25
32
  website/index.html
26
33
  website/index.txt
27
34
  website/javascripts/rounded_corners_lite.inc.js
28
35
  website/stylesheets/screen.css
29
36
  website/template.rhtml
37
+ xor.train
38
+ xor_cascade.net
39
+ xor_float.net
data/README.txt CHANGED
@@ -1 +1,12 @@
1
- README
1
+ = RubyFann
2
+ Bindings to use FANN from within ruby/rails environment.
3
+ Requires:
4
+ FANN 2.1 or greater (preferably in /usr/local/lib)
5
+ Ruby 1.8.6 or greater.
6
+ gnu make tools or equiv for native code in ext
7
+
8
+ == Examples
9
+ train = RubyFann::TrainData.new(:inputs=>[[0.3, 0.4, 0.5], [0.1, 0.2, 0.3]], :desired_outputs=>[[0.7], [0.8]])
10
+ fann = RubyFann::Standard.new(:num_inputs=>5, :hidden_neurons=>[2, 8, 4, 3, 4], :num_outputs=>1)
11
+ fann.train_on_data(train, 1000, 10, 0.1)
12
+ outputs = fann.run([3.0, 2.0, 3.0])
data/config/hoe.rb CHANGED
@@ -35,7 +35,7 @@ VERS = RubyFann::VERSION::STRING + (REV ? ".#{REV}" : "")
35
35
  RDOC_OPTS = ['--quiet', '--title', 'ruby_fann documentation',
36
36
  "--opname", "index.html",
37
37
  "--line-numbers",
38
- "--main", "README",
38
+ "--main", "README.txt",
39
39
  "--inline-source"]
40
40
 
41
41
  class Hoe
@@ -61,7 +61,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
61
61
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
62
62
  #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
63
63
 
64
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
+ p.spec_extras = {:extensions => "ext/ruby_fann/extconf.rb"} # A hash of extra values to set in the gemspec.
65
65
 
66
66
  end
67
67
 
@@ -0,0 +1,3 @@
1
+ extconf.rb
2
+ fann_augment.h
3
+ neural_network.c
@@ -0,0 +1,149 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /usr/local/lib/ruby/1.8/i686-darwin8.11.1
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ prefix = $(DESTDIR)/usr/local
11
+ exec_prefix = $(prefix)
12
+ sitedir = $(prefix)/lib/ruby/site_ruby
13
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
14
+ docdir = $(datarootdir)/doc/$(PACKAGE)
15
+ dvidir = $(docdir)
16
+ datarootdir = $(prefix)/share
17
+ archdir = $(rubylibdir)/$(arch)
18
+ sbindir = $(exec_prefix)/sbin
19
+ psdir = $(docdir)
20
+ localedir = $(datarootdir)/locale
21
+ htmldir = $(docdir)
22
+ datadir = $(datarootdir)
23
+ includedir = $(prefix)/include
24
+ infodir = $(datarootdir)/info
25
+ sysconfdir = $(prefix)/etc
26
+ mandir = $(datarootdir)/man
27
+ libdir = $(exec_prefix)/lib
28
+ sharedstatedir = $(prefix)/com
29
+ oldincludedir = $(DESTDIR)/usr/include
30
+ pdfdir = $(docdir)
31
+ sitearchdir = $(sitelibdir)/$(sitearch)
32
+ bindir = $(exec_prefix)/bin
33
+ localstatedir = $(prefix)/var
34
+ sitelibdir = $(sitedir)/$(ruby_version)
35
+ libexecdir = $(exec_prefix)/libexec
36
+
37
+ CC = gcc
38
+ LIBRUBY = $(LIBRUBY_SO)
39
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
40
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
41
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
42
+
43
+ RUBY_EXTCONF_H =
44
+ CFLAGS = -fno-common -g -O2 -fno-common -pipe -fno-common
45
+ INCFLAGS = -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.11.1 -I.
46
+ CPPFLAGS =
47
+ CXXFLAGS = $(CFLAGS)
48
+ DLDFLAGS = -L.
49
+ LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
50
+ AR = ar
51
+ EXEEXT =
52
+
53
+ RUBY_INSTALL_NAME = ruby
54
+ RUBY_SO_NAME = ruby
55
+ arch = i686-darwin8.11.1
56
+ sitearch = i686-darwin8.11.1
57
+ ruby_version = 1.8
58
+ ruby = /usr/local/bin/ruby
59
+ RUBY = $(ruby)
60
+ RM = rm -f
61
+ MAKEDIRS = mkdir -p
62
+ INSTALL = /usr/bin/install -c
63
+ INSTALL_PROG = $(INSTALL) -m 0755
64
+ INSTALL_DATA = $(INSTALL) -m 644
65
+ COPY = cp
66
+
67
+ #### End of system configuration section. ####
68
+
69
+ preload =
70
+
71
+ libpath = . $(libdir)
72
+ LIBPATH = -L"." -L"$(libdir)"
73
+ DEFFILE =
74
+
75
+ CLEANFILES = mkmf.log
76
+ DISTCLEANFILES =
77
+
78
+ extout =
79
+ extout_prefix =
80
+ target_prefix =
81
+ LOCAL_LIBS =
82
+ LIBS = $(LIBRUBYARG_SHARED) -ldoublefann -lpthread -ldl -lobjc
83
+ SRCS = neural_network.c
84
+ OBJS = neural_network.o
85
+ TARGET = neural_network
86
+ DLLIB = $(TARGET).bundle
87
+ EXTSTATIC =
88
+ STATIC_LIB =
89
+
90
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
91
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
92
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
93
+
94
+ TARGET_SO = $(DLLIB)
95
+ CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
96
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
97
+
98
+ all: $(DLLIB)
99
+ static: $(STATIC_LIB)
100
+
101
+ clean:
102
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
103
+
104
+ distclean: clean
105
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
106
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
107
+
108
+ realclean: distclean
109
+ install: install-so install-rb
110
+
111
+ install-so: $(RUBYARCHDIR)
112
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
113
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
114
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
115
+ install-rb: pre-install-rb install-rb-default
116
+ install-rb-default: pre-install-rb-default
117
+ pre-install-rb: Makefile
118
+ pre-install-rb-default: Makefile
119
+ $(RUBYARCHDIR):
120
+ $(MAKEDIRS) $@
121
+
122
+ site-install: site-install-so site-install-rb
123
+ site-install-so: install-so
124
+ site-install-rb: install-rb
125
+
126
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
127
+
128
+ .cc.o:
129
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
130
+
131
+ .cxx.o:
132
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
133
+
134
+ .cpp.o:
135
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
136
+
137
+ .C.o:
138
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
139
+
140
+ .c.o:
141
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
142
+
143
+ $(DLLIB): $(OBJS)
144
+ @-$(RM) $@
145
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
146
+
147
+
148
+
149
+ $(OBJS): ruby.h defines.h
@@ -1002,11 +1002,11 @@ static VALUE test_data(VALUE self, VALUE train_data)
1002
1002
  // return INT2NUM(fann_get_multiplier(f));
1003
1003
  // }
1004
1004
 
1005
- // Train with inputs (array of arrays) & desired_outputs (array of arrays)
1006
- // inputs & desired outputs should be of same length
1007
- // All sub-arrays on inputs should be of same length
1008
- // All sub-arrays on desired outputs should be of same length
1009
- // Sub-arrays on inputs & desired_outputs can be different sizes from one another
1005
+ /** Perform cascade training with training data created with RubyFann::TrainData.new
1006
+ max_epochs - The maximum number of neurons in trained network
1007
+ neurons_between_reports - The number of neurons between printing a status report to stdout.
1008
+ desired_error - The desired <get_MSE> or <get_bit_fail>, depending on which stop function
1009
+ is chosen by <set_train_stop_function>. */
1010
1010
  static VALUE cascadetrain_on_data(VALUE self, VALUE train_data, VALUE max_neurons, VALUE neurons_between_reports, VALUE desired_error)
1011
1011
  {
1012
1012
  Check_Type(train_data, T_DATA);
@@ -2,7 +2,7 @@ module RubyFann #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 7
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/neurotica1.png ADDED
Binary file
data/neurotica2.vrml ADDED
@@ -0,0 +1,304 @@
1
+ #VRML V2.0 utf8
2
+ Group { children [
3
+ Transform {
4
+ scale 0.028 0.028 0.028
5
+ children [
6
+ Background { skyColor 1.000 1.000 1.000 }
7
+ # node 8471040
8
+ Transform {
9
+ translation 6.000 46.000 30.000
10
+ scale 2.000 2.000 2.000
11
+ children [
12
+ Transform {
13
+ children [
14
+ Shape {
15
+ geometry Sphere { radius 1.0 }
16
+ appearance Appearance {
17
+ material Material {
18
+ ambientIntensity 0.33
19
+ diffuseColor 0.000 0.000 0.000
20
+ }
21
+ }
22
+ }
23
+ ]
24
+ }
25
+ ]
26
+ }
27
+ # node 8470590
28
+ Transform {
29
+ translation 50.000 6.000 71.000
30
+ scale 2.000 2.000 2.000
31
+ children [
32
+ Transform {
33
+ children [
34
+ Shape {
35
+ geometry Sphere { radius 1.0 }
36
+ appearance Appearance {
37
+ material Material {
38
+ ambientIntensity 0.33
39
+ diffuseColor 0.000 0.000 0.000
40
+ }
41
+ }
42
+ }
43
+ ]
44
+ }
45
+ ]
46
+ }
47
+ # edge 8471040 -> 8470590
48
+ Group { children [
49
+ Transform {
50
+ children [
51
+ Shape {
52
+ geometry Cylinder {
53
+ bottom FALSE top FALSE
54
+ height 38.822 radius 1.000 }
55
+ appearance Appearance {
56
+ material Material {
57
+ ambientIntensity 0.33
58
+ diffuseColor 0.000 0.000 1.000
59
+ }
60
+ }
61
+ }
62
+ Transform {
63
+ translation 0 24.411 0
64
+ children [
65
+ Shape {
66
+ geometry Cone {bottomRadius 3.500 height 10.000 }
67
+ appearance Appearance {
68
+ material Material {
69
+ ambientIntensity 0.33
70
+ diffuseColor 0.000 0.000 1.000
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ center 0 5.000 0
78
+ rotation -0.000 0 -22.000 -3.975
79
+ translation 24.000 17.000 0.000
80
+ }
81
+ ] }
82
+ # node 8470810
83
+ Transform {
84
+ translation 28.000 46.000 5.000
85
+ scale 2.000 2.000 2.000
86
+ children [
87
+ Transform {
88
+ children [
89
+ Shape {
90
+ geometry Sphere { radius 1.0 }
91
+ appearance Appearance {
92
+ material Material {
93
+ ambientIntensity 0.33
94
+ diffuseColor 0.000 0.000 0.000
95
+ }
96
+ }
97
+ }
98
+ ]
99
+ }
100
+ ]
101
+ }
102
+ # edge 8470810 -> 8470590
103
+ Group { children [
104
+ Transform {
105
+ children [
106
+ Shape {
107
+ geometry Cylinder {
108
+ bottom FALSE top FALSE
109
+ height 25.133 radius 1.000 }
110
+ appearance Appearance {
111
+ material Material {
112
+ ambientIntensity 0.33
113
+ diffuseColor 0.000 0.000 1.000
114
+ }
115
+ }
116
+ }
117
+ Transform {
118
+ translation 0 17.566 0
119
+ children [
120
+ Shape {
121
+ geometry Cone {bottomRadius 3.500 height 10.000 }
122
+ appearance Appearance {
123
+ material Material {
124
+ ambientIntensity 0.33
125
+ diffuseColor 0.000 0.000 1.000
126
+ }
127
+ }
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ center 0 5.000 0
133
+ rotation -0.000 0 -11.000 -3.644
134
+ translation 35.000 17.000 0.000
135
+ }
136
+ ] }
137
+ # node 8470760
138
+ Transform {
139
+ translation 50.000 46.000 21.000
140
+ scale 2.000 2.000 2.000
141
+ children [
142
+ Transform {
143
+ children [
144
+ Shape {
145
+ geometry Sphere { radius 1.0 }
146
+ appearance Appearance {
147
+ material Material {
148
+ ambientIntensity 0.33
149
+ diffuseColor 0.000 0.000 0.000
150
+ }
151
+ }
152
+ }
153
+ ]
154
+ }
155
+ ]
156
+ }
157
+ # edge 8470760 -> 8470590
158
+ Group { children [
159
+ Transform {
160
+ children [
161
+ Shape {
162
+ geometry Cylinder {
163
+ bottom FALSE top FALSE
164
+ height 19.035 radius 1.000 }
165
+ appearance Appearance {
166
+ material Material {
167
+ ambientIntensity 0.33
168
+ diffuseColor 0.000 0.000 1.000
169
+ }
170
+ }
171
+ }
172
+ Transform {
173
+ translation 0 14.518 0
174
+ children [
175
+ Shape {
176
+ geometry Cone {bottomRadius 3.500 height 10.000 }
177
+ appearance Appearance {
178
+ material Material {
179
+ ambientIntensity 0.33
180
+ diffuseColor 0.000 0.000 1.000
181
+ }
182
+ }
183
+ }
184
+ ]
185
+ }
186
+ ]
187
+ center 0 5.000 0
188
+ rotation -0.000 0 1.000 -3.142
189
+ translation 46.000 17.000 0.000
190
+ }
191
+ ] }
192
+ # node 8470710
193
+ Transform {
194
+ translation 72.000 46.000 9.000
195
+ scale 2.000 2.000 2.000
196
+ children [
197
+ Transform {
198
+ children [
199
+ Shape {
200
+ geometry Sphere { radius 1.0 }
201
+ appearance Appearance {
202
+ material Material {
203
+ ambientIntensity 0.33
204
+ diffuseColor 0.000 0.000 0.000
205
+ }
206
+ }
207
+ }
208
+ ]
209
+ }
210
+ ]
211
+ }
212
+ # edge 8470710 -> 8470590
213
+ Group { children [
214
+ Transform {
215
+ children [
216
+ Shape {
217
+ geometry Cylinder {
218
+ bottom FALSE top FALSE
219
+ height 24.018 radius 1.000 }
220
+ appearance Appearance {
221
+ material Material {
222
+ ambientIntensity 0.33
223
+ diffuseColor 0.000 0.000 1.000
224
+ }
225
+ }
226
+ }
227
+ Transform {
228
+ translation 0 17.009 0
229
+ children [
230
+ Shape {
231
+ geometry Cone {bottomRadius 3.500 height 10.000 }
232
+ appearance Appearance {
233
+ material Material {
234
+ ambientIntensity 0.33
235
+ diffuseColor 0.000 0.000 1.000
236
+ }
237
+ }
238
+ }
239
+ ]
240
+ }
241
+ ]
242
+ center 0 5.000 0
243
+ rotation -0.000 0 11.000 -3.644
244
+ translation 57.000 17.000 0.000
245
+ }
246
+ ] }
247
+ # node 8470650
248
+ Transform {
249
+ translation 94.000 46.000 90.000
250
+ scale 2.000 2.000 2.000
251
+ children [
252
+ Transform {
253
+ children [
254
+ Shape {
255
+ geometry Sphere { radius 1.0 }
256
+ appearance Appearance {
257
+ material Material {
258
+ ambientIntensity 0.33
259
+ diffuseColor 0.000 0.000 0.000
260
+ }
261
+ }
262
+ }
263
+ ]
264
+ }
265
+ ]
266
+ }
267
+ # edge 8470650 -> 8470590
268
+ Group { children [
269
+ Transform {
270
+ children [
271
+ Shape {
272
+ geometry Cylinder {
273
+ bottom FALSE top FALSE
274
+ height 37.531 radius 1.000 }
275
+ appearance Appearance {
276
+ material Material {
277
+ ambientIntensity 0.33
278
+ diffuseColor 0.000 0.000 1.000
279
+ }
280
+ }
281
+ }
282
+ Transform {
283
+ translation 0 23.765 0
284
+ children [
285
+ Shape {
286
+ geometry Cone {bottomRadius 3.500 height 10.000 }
287
+ appearance Appearance {
288
+ material Material {
289
+ ambientIntensity 0.33
290
+ diffuseColor 0.000 0.000 1.000
291
+ }
292
+ }
293
+ }
294
+ ]
295
+ }
296
+ ]
297
+ center 0 5.000 0
298
+ rotation -0.000 0 22.000 -3.975
299
+ translation 68.000 17.000 0.000
300
+ }
301
+ ] }
302
+ ] }
303
+ Viewpoint {position 1.852 0.963 6.147}
304
+ ] }
data/test/test.train ADDED
@@ -0,0 +1,3 @@
1
+ 1 3 1
2
+ 0.200000 0.300000 0.400000
3
+ 3.140000
@@ -1,8 +1,8 @@
1
1
  require 'test/unit'
2
2
  require "rubygems"
3
3
  require "graphviz"
4
- require 'ext/ruby_fann/neural_network'
5
- require 'lib/ruby_fann/neurotica'
4
+ require 'ruby_fann/neural_network'
5
+ require 'ruby_fann/neurotica'
6
6
 
7
7
  class NeuroticaTest < Test::Unit::TestCase
8
8
  def test_basic_output
@@ -1,5 +1,6 @@
1
1
  require 'test/unit'
2
- require 'ext/ruby_fann/neural_network'
2
+ require 'rubygems'
3
+ require 'ruby_fann/neural_network'
3
4
 
4
5
  class MyShortcut < RubyFann::Shortcut
5
6
  def initialize
@@ -1,5 +1,6 @@
1
1
  require 'test/unit'
2
- require 'ext/ruby_fann/neural_network'
2
+ require 'rubygems'
3
+ require 'ruby_fann/neural_network'
3
4
 
4
5
  class RubyFannFunctionalTest < Test::Unit::TestCase
5
6
  XOR_INPUT_DATA = [[-1, -1], [-1, 1], [1, -1], [1, 1]]
data/verify.train ADDED
@@ -0,0 +1,3 @@
1
+ 1 3 1
2
+ 0.200000 0.300000 0.400000
3
+ 3.140000
data/website/index.html CHANGED
@@ -35,10 +35,13 @@
35
35
  <p>Get Version</p>
36
36
  <a href="http://rubyforge.org/projects/ruby-fann" class="numbers">0.7.2</a>
37
37
  </div>
38
- <h2>What</h2>
38
+ <p><em>Bindings to use <a href="http://leenissen.dk/fann/"><span class="caps">FANN</span></a> (Fast Artificial Neural Network) from within ruby/rails environment.</em></p>
39
39
 
40
40
 
41
- <p>Bindings to use <span class="caps">FANN</span> (Fast Artificial Neural Network) from within ruby/rails environment.</p>
41
+ <h2>Documentation</h2>
42
+
43
+
44
+ <p>Get your documentation here: <a href="http://ruby-fann.rubyforge.org/rdoc">Docs</a></p>
42
45
 
43
46
 
44
47
  <h2>Installing</h2>
@@ -49,7 +52,7 @@
49
52
 
50
53
  <p><a href="http://leenissen.dk/fann/">http://leenissen.dk/fann/</a></p>
51
54
  </li>
52
- <li>Then, install the ruby bindings:
55
+ <li>Then, install ruby-fann:
53
56
  <pre class='syntax'><span class="ident">sudo</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>
54
57
  </ul>
55
58
 
@@ -68,16 +71,17 @@
68
71
 
69
72
 
70
73
  <p><pre class='syntax'>
74
+ <span class="ident">require</span> <span class="punct">'</span><span class="string">rubygems</span><span class="punct">'</span>
71
75
  <span class="ident">require</span> <span class="punct">'</span><span class="string">ruby_fann/neural_network</span><span class="punct">'</span>
72
76
  <span class="ident">training_data</span> <span class="punct">=</span> <span class="constant">RubyFann</span><span class="punct">::</span><span class="constant">TrainData</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span>
73
77
  <span class="symbol">:inputs=</span><span class="punct">&gt;[[</span><span class="number">0.3</span><span class="punct">,</span> <span class="number">0.4</span><span class="punct">,</span> <span class="number">0.5</span><span class="punct">],</span> <span class="punct">[</span><span class="number">0.1</span><span class="punct">,</span> <span class="number">0.2</span><span class="punct">,</span> <span class="number">0.3</span><span class="punct">]],</span>
74
78
  <span class="symbol">:desired_outputs=</span><span class="punct">&gt;[[</span><span class="number">0.7</span><span class="punct">],</span> <span class="punct">[</span><span class="number">0.8</span><span class="punct">]])</span>
75
- <span class="ident">neural_network</span> <span class="punct">=</span> <span class="constant">RubyFann</span><span class="punct">::</span><span class="constant">Standard</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span>
76
- <span class="symbol">:num_inputs=</span><span class="punct">&gt;</span><span class="number">5</span><span class="punct">,</span>
79
+ <span class="ident">fann</span> <span class="punct">=</span> <span class="constant">RubyFann</span><span class="punct">::</span><span class="constant">Standard</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span>
80
+ <span class="symbol">:num_inputs=</span><span class="punct">&gt;</span><span class="number">3</span><span class="punct">,</span>
77
81
  <span class="symbol">:hidden_neurons=</span><span class="punct">&gt;[</span><span class="number">2</span><span class="punct">,</span> <span class="number">8</span><span class="punct">,</span> <span class="number">4</span><span class="punct">,</span> <span class="number">3</span><span class="punct">,</span> <span class="number">4</span><span class="punct">],</span>
78
82
  <span class="symbol">:num_outputs=</span><span class="punct">&gt;</span><span class="number">1</span><span class="punct">)</span>
79
- <span class="ident">neural_network</span><span class="punct">.</span><span class="ident">train_on_data</span><span class="punct">(</span><span class="ident">training_data</span><span class="punct">,</span> <span class="number">1000</span><span class="punct">,</span> <span class="number">10</span><span class="punct">,</span> <span class="number">0.1</span><span class="punct">)</span>
80
- <span class="ident">outputs</span> <span class="punct">=</span> <span class="ident">neural_network</span><span class="punct">.</span><span class="ident">run</span><span class="punct">([</span><span class="number">3.0</span><span class="punct">,</span> <span class="number">2.0</span><span class="punct">,</span> <span class="number">3.0</span><span class="punct">])</span>
83
+ <span class="ident">fann</span><span class="punct">.</span><span class="ident">train_on_data</span><span class="punct">(</span><span class="ident">training_data</span><span class="punct">,</span> <span class="number">1000</span><span class="punct">,</span> <span class="number">1</span><span class="punct">,</span> <span class="number">0.1</span><span class="punct">)</span>
84
+ <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>
81
85
  </pre></p>
82
86
 
83
87
 
@@ -107,7 +111,7 @@
107
111
 
108
112
  <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>
109
113
  <p class="coda">
110
- <a href="steven@7bpeople.com">Steven Miers</a>, 18th December 2007<br>
114
+ <a href="steven@7bpeople.com">Steven Miers</a>, 19th December 2007<br>
111
115
  </p>
112
116
  </div>
113
117
 
data/website/index.txt CHANGED
@@ -1,16 +1,17 @@
1
1
  h1. ruby-fann
2
2
 
3
- h2. What
3
+ _Bindings to use "FANN":http://leenissen.dk/fann/ (Fast Artificial Neural Network) from within ruby/rails environment._
4
4
 
5
- Bindings to use FANN (Fast Artificial Neural Network) from within ruby/rails environment.
5
+ h2. Documentation
6
6
 
7
+ Get your documentation here: "Docs":http://ruby-fann.rubyforge.org/rdoc
7
8
 
8
9
  h2. Installing
9
10
 
10
11
  * First, Go here & install FANN for your platform:
11
12
 
12
13
  "http://leenissen.dk/fann/":http://leenissen.dk/fann/
13
- * Then, install the ruby bindings:
14
+ * Then, install ruby-fann:
14
15
  <pre syntax="ruby">sudo gem install ruby-fann</pre>
15
16
 
16
17
  h2. Requirements:
@@ -23,16 +24,17 @@ h2. Requirements:
23
24
  h2. Demonstration of usage
24
25
 
25
26
  <pre syntax="ruby">
27
+ require 'rubygems'
26
28
  require 'ruby_fann/neural_network'
27
29
  training_data = RubyFann::TrainData.new(
28
30
  :inputs=>[[0.3, 0.4, 0.5], [0.1, 0.2, 0.3]],
29
31
  :desired_outputs=>[[0.7], [0.8]])
30
- neural_network = RubyFann::Standard.new(
31
- :num_inputs=>5,
32
+ fann = RubyFann::Standard.new(
33
+ :num_inputs=>3,
32
34
  :hidden_neurons=>[2, 8, 4, 3, 4],
33
35
  :num_outputs=>1)
34
- neural_network.train_on_data(training_data, 1000, 10, 0.1)
35
- outputs = neural_network.run([3.0, 2.0, 3.0])
36
+ fann.train_on_data(training_data, 1000, 1, 0.1)
37
+ outputs = fann.run([0.7, 0.9, 0.2])
36
38
  </pre>
37
39
 
38
40
  h2. Forum
data/xor.train ADDED
@@ -0,0 +1,9 @@
1
+ 4 2 1
2
+ -1 -1
3
+ -1
4
+ -1 1
5
+ 1
6
+ 1 -1
7
+ 1
8
+ 1 1
9
+ -1
data/xor_cascade.net ADDED
@@ -0,0 +1,34 @@
1
+ FANN_FLO_2.1
2
+ num_layers=4
3
+ learning_rate=0.700000
4
+ connection_rate=1.000000
5
+ network_type=1
6
+ learning_momentum=0.000000
7
+ training_algorithm=2
8
+ train_error_function=0
9
+ train_stop_function=0
10
+ cascade_output_change_fraction=0.010000
11
+ quickprop_decay=-0.000100
12
+ quickprop_mu=1.750000
13
+ rprop_increase_factor=1.200000
14
+ rprop_decrease_factor=0.500000
15
+ rprop_delta_min=0.000000
16
+ rprop_delta_max=50.000000
17
+ rprop_delta_zero=0.100000
18
+ cascade_output_stagnation_epochs=12
19
+ cascade_candidate_change_fraction=0.010000
20
+ cascade_candidate_stagnation_epochs=12
21
+ cascade_max_out_epochs=150
22
+ cascade_max_cand_epochs=150
23
+ cascade_num_candidate_groups=2
24
+ bit_fail_limit=3.49999999999999977796e-01
25
+ cascade_candidate_limit=1.00000000000000000000e+03
26
+ cascade_weight_multiplier=4.00000000000000022204e-01
27
+ cascade_activation_functions_count=10
28
+ cascade_activation_functions=3 5 7 8 10 11 14 15 16 17
29
+ cascade_activation_steepnesses_count=4
30
+ cascade_activation_steepnesses=2.50000000000000000000e-01 5.00000000000000000000e-01 7.50000000000000000000e-01 1.00000000000000000000e+00
31
+ layer_sizes=3 1 1 1
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, 14, 7.50000000000000000000e-01) (4, 7, 1.00000000000000000000e+00) (5, 5, 5.00000000000000000000e-01)
34
+ connections (connected_to_neuron, weight)=(0, 1.69368225817805306832e+00) (1, 2.08920519418653682919e+00) (2, 2.08209278669541841822e+00) (0, 3.34013988327298427805e+00) (1, 2.93217698586362640611e+00) (2, 3.22640486156344952207e+00) (3, 3.11359130974472542164e+00) (0, 3.15916855833715426449e-01) (1, 2.36476269687895951366e-01) (2, -2.40909157788608524475e-01) (3, 4.02651493128943016586e+01) (4, -2.06887458728570478028e-01)
data/xor_float.net ADDED
@@ -0,0 +1,34 @@
1
+ FANN_FLO_2.1
2
+ num_layers=3
3
+ learning_rate=0.700000
4
+ connection_rate=1.000000
5
+ network_type=0
6
+ learning_momentum=0.000000
7
+ training_algorithm=2
8
+ train_error_function=1
9
+ train_stop_function=1
10
+ cascade_output_change_fraction=0.010000
11
+ quickprop_decay=-0.000100
12
+ quickprop_mu=1.750000
13
+ rprop_increase_factor=1.200000
14
+ rprop_decrease_factor=0.500000
15
+ rprop_delta_min=0.000000
16
+ rprop_delta_max=50.000000
17
+ rprop_delta_zero=0.100000
18
+ cascade_output_stagnation_epochs=12
19
+ cascade_candidate_change_fraction=0.010000
20
+ cascade_candidate_stagnation_epochs=12
21
+ cascade_max_out_epochs=150
22
+ cascade_max_cand_epochs=150
23
+ cascade_num_candidate_groups=2
24
+ bit_fail_limit=1.00000000000000002082e-03
25
+ cascade_candidate_limit=1.00000000000000000000e+03
26
+ cascade_weight_multiplier=4.00000000000000022204e-01
27
+ cascade_activation_functions_count=10
28
+ cascade_activation_functions=3 5 7 8 10 11 14 15 16 17
29
+ cascade_activation_steepnesses_count=4
30
+ cascade_activation_steepnesses=2.50000000000000000000e-01 5.00000000000000000000e-01 7.50000000000000000000e-01 1.00000000000000000000e+00
31
+ layer_sizes=3 4 2
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, 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, 1.77563726355814255342e+00) (1, 1.70865512093591309650e+00) (2, -1.35620772409434886541e+00) (0, 2.54763445407383049002e+00) (1, 2.38503950578006485017e+00) (2, 1.82714622361575518283e+00) (0, 2.23745614983482665750e+00) (1, 2.06383714945245611005e+00) (2, -2.08187721657654112306e+00) (3, -2.44900226502112489113e-01) (4, 4.89073018141245707824e+00) (5, -4.73615236757579260995e+00) (6, -4.61604992747759812488e+00)
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ruby-fann
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.7.2
7
- date: 2007-12-18 00:00:00 -06:00
6
+ version: 0.7.3
7
+ date: 2007-12-19 00:00:00 -06:00
8
8
  summary: Bindings to use FANN from within ruby/rails environment.
9
9
  require_paths:
10
10
  - lib
@@ -37,14 +37,17 @@ files:
37
37
  - Rakefile
38
38
  - config/hoe.rb
39
39
  - config/requirements.rb
40
- - doc
40
+ - ext/ruby_fann/MANIFEST
41
+ - ext/ruby_fann/Makefile
41
42
  - ext/ruby_fann/extconf.rb
42
43
  - ext/ruby_fann/fann_augment.h
43
44
  - ext/ruby_fann/neural_network.c
44
45
  - lib/ruby_fann.rb
45
- - lib/ruby_fann/version.rb
46
46
  - lib/ruby_fann/neurotica.rb
47
+ - lib/ruby_fann/version.rb
47
48
  - log/debug.log
49
+ - neurotica1.png
50
+ - neurotica2.vrml
48
51
  - script/destroy
49
52
  - script/generate
50
53
  - script/txt2html
@@ -52,13 +55,20 @@ files:
52
55
  - tasks/deployment.rake
53
56
  - tasks/environment.rake
54
57
  - tasks/website.rake
58
+ - test/test.train
55
59
  - test/test_helper.rb
60
+ - test/test_neurotica.rb
56
61
  - test/test_ruby_fann.rb
62
+ - test/test_ruby_fann_functional.rb
63
+ - verify.train
57
64
  - website/index.html
58
65
  - website/index.txt
59
66
  - website/javascripts/rounded_corners_lite.inc.js
60
67
  - website/stylesheets/screen.css
61
68
  - website/template.rhtml
69
+ - xor.train
70
+ - xor_cascade.net
71
+ - xor_float.net
62
72
  test_files:
63
73
  - test/test_helper.rb
64
74
  - test/test_neurotica.rb
@@ -75,8 +85,8 @@ extra_rdoc_files:
75
85
  - website/index.txt
76
86
  executables: []
77
87
 
78
- extensions: []
79
-
88
+ extensions:
89
+ - ext/ruby_fann/extconf.rb
80
90
  requirements: []
81
91
 
82
92
  dependencies: []