trouble with train_on_file

32 views
Skip to first unread message

ronny

unread,
Feb 8, 2010, 7:46:15 PM2/8/10
to ruby_fann
I installed ruby-fann 1.0.3 on a Mac (OS 10.5.8) according to the
instruction at: http://ruby-fann.rubyforge.org/

The example runs fine, but when I construct my own training file and
call fann.train_on_file() I get the error:

undefined method `train_on_file' for main:Object (NoMethodError)

I can't find documentation of the method at http://ruby-fann.rubyforge.org/rdoc/

Is there a reason that this doesn't seem to have been implemented? am
I missing something?

code included below


require 'rubygems'
require 'ruby_fann/neural_network'

training_data = RubyFann::TrainData.new(
:inputs=>[[1.0, 1.0], [1.0, 0.0], [0.0, 1.0], [0.0, 0.0], [0.4,
0.4], [0.6, 0.6]],
:desired_outputs=>[[0.0], [1.0], [1.0], [0.0], [1.0], [0.0]])

fann = RubyFann::Standard.new(
:num_inputs=>2,
:hidden_neurons=>[10, 10],
:num_outputs=>1)

fann.set_train_stop_function(:mse)
fann.set_train_error_function(:tanh)
fann.set_activation_function_layer(:sigmoid_symmetric, 0)
fann.set_activation_function_output(:sigmoid_symmetric)
fann.set_learning_momentum(0.5)
fann.set_learning_rate(0.01)

fann.train_on_data(training_data, 10000, 500,
0.000001)
outputs = fann.run([0.9, 0.1])
puts outputs

fann.train_on_file("train.set", 10000, 500,
0.000001)
outputs = fann.run([0.9, 0.1])
puts outputs

Reply all
Reply to author
Forward
0 new messages