Created
May 7, 2013 15:13
-
-
Save nmeans/5533387 to your computer and use it in GitHub Desktop.
ruby-fann negative/positive demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input = (-1000...1000).collect{|i| [i]} | |
output = input.map{|i| i > 0 ? [1,0] : [0,1]} | |
train = RubyFann::TrainData.new(:inputs => input, :desired_outputs => output) | |
fann = RubyFann::Standard.new(:num_inputs=>2, :hidden_neurons=>[3,3,3], :num_outputs=>2) | |
fann.train_on_data(train, 1001, 10, 0.001) | |
fann.run([-500]) # [0.03544681023290716, 1.0] | |
fann.run([500]) # [1.0, 0.0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment