ruby-fann 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +64 -0
  2. data/lib/ruby_fann/version.rb +1 -1
  3. metadata +5 -2
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Ruby::Fann
2
+
3
+ Bindings to use FANN from within ruby/rails environment. Fann is a is a free open source neural network library, which implements multilayer artificial neural networks with support for both fully connected and sparsely connected networks. It is easy to use, versatile, well documented, and fast. RubyFann makes working with neural networks a breeze using ruby, with the added benefit that most of the heavy lifting is done natively.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'ruby-fann'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install ruby-fann
18
+
19
+ ## Usage
20
+
21
+ ### Example training & subsequent execution:
22
+
23
+ ```ruby
24
+ require 'ruby-fann'
25
+ train = RubyFann::TrainData.new(:inputs=>[[0.3, 0.4, 0.5], [0.1, 0.2, 0.3]], :desired_outputs=>[[0.7], [0.8]])
26
+ fann = RubyFann::Standard.new(:num_inputs=>5, :hidden_neurons=>[2, 8, 4, 3, 4], :num_outputs=>1)
27
+ fann.train_on_data(train, 1000, 10, 0.1)
28
+ outputs = fann.run([0.3, 0.2, 0.4])
29
+ ```
30
+
31
+ ### Save trained NN to file and use it later (continued from above)
32
+
33
+ ```ruby
34
+ train.save('verify.train')
35
+ train = RubyFann::TrainData.new(:filename=>'verify.train')
36
+ outputs = fann.run([0.1, 0.9, 0.4])
37
+ ```
38
+
39
+ ### Now implements a callback method
40
+
41
+ This callback function can be called during training when using train_on_data, train_on_file or cascadetrain_on_data.
42
+
43
+ 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 is the parameters given to the train_on_data, plus an epochs parameter which tells how many epochs the training have taken so far.
44
+
45
+ The callback method should return an integer, if the callback function returns -1, the training will terminate.
46
+
47
+ The callback (training_callback) will be automatically called if it is implemented on your subclass as follows:
48
+
49
+ ```ruby
50
+ class MyFann < RubyFann::Standard
51
+ def training_callback(args)
52
+ puts "ARGS: #{args.inspect}"
53
+ 0
54
+ end
55
+ end
56
+ ```
57
+
58
+ ## Contributing
59
+
60
+ 1. Fork it
61
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 4. Push to the branch (`git push origin my-new-feature`)
64
+ 5. Create new Pull Request
@@ -2,7 +2,7 @@ module RubyFann #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -17,7 +17,9 @@ email:
17
17
  executables: []
18
18
  extensions:
19
19
  - ext/ruby_fann/extconf.rb
20
- extra_rdoc_files: []
20
+ extra_rdoc_files:
21
+ - README.md
22
+ - ext/ruby_fann/ruby_fann.c
21
23
  files:
22
24
  - lib/ruby-fann.rb
23
25
  - lib/ruby_fann/neurotica.rb
@@ -44,6 +46,7 @@ files:
44
46
  - ext/ruby_fann/fann_train.h
45
47
  - ext/ruby_fann/ruby_compat.h
46
48
  - ext/ruby_fann/extconf.rb
49
+ - README.md
47
50
  homepage: http://github.com/tangledpath/ruby-fann
48
51
  licenses: []
49
52
  post_install_message: