Sample script working in ruby but segfaulting in irb.

67 views
Skip to first unread message

André

unread,
Nov 16, 2008, 9:05:27 AM11/16/08
to ruby_fann
Hello all,

I'm trying to run the simpe test sample given on the Ruby-fann install
page.
It runs fine when I run the script with ruby, I get a segfault when I
run it through irb.

I installed (manually) libfann v2.1 and the ruby_fann gem.
Linux Debian testing.
Is this an irb bug, a ruby-fann bug? I don't quite know to whom I
should report it.

Log below.

-----------------------------------------------------------------------------------------------------------------------------

13:56 andre@LonLT093 ~/Desktop/Fann/fann-2.1.0/examples% irb <
sample_ruby.rb
require 'rubygems'
true
require 'ruby_fann/neural_network'
Initialized Ruby Bindings for FANN.
true

# Create Training data with 2 each of inputs(array of 3) & desired
outputs(array of 1).
training_data = RubyFann::TrainData.new(
:inputs=>[[0.3, 0.4, 0.5], [0.1, 0.2, 0.3]],
:desired_outputs=>[[0.7], [0.8]])
#<RubyFann::TrainData:0xb7c230f0>

# Create FANN Neural Network to match appropriate training data:
fann = RubyFann::Standard.new(
:num_inputs=>3,
:hidden_neurons=>[2, 8, 4, 3, 4],
:num_outputs=>1)
initializing


Created RubyFann::Standard [164195704].
Checking for callback...none found.
#<RubyFann::Standard:0xb7c67c28>

# Training using data created above:
fann.train_on_data(training_data, 1000, 1, 0.1)
Max epochs 1000. Desired error: 0.1000000015.
Epochs 1. Current error: 0.0848674923. Bit fail 0.
/usr/lib/ruby/1.8/irb.rb:302: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

[2] 31844 abort irb < sample_ruby.rb

-----------------------------------------------------------------------------------------------------------------------------

13:57 andre@LonLT093 ~/Desktop/Fann/fann-2.1.0/examples% ruby
sample_ruby.rb
Initialized Ruby Bindings for FANN.
initializing


Created RubyFann::Standard [163977352].
Checking for callback...none found.
Max epochs 1000. Desired error: 0.1000000015.
Epochs 1. Current error: 0.0611918829. Bit fail 0.
Hello there
Destroyed FANN network [163977352].
Destroyed Training data [163977032].


-----------------------------------------------------------------------------------------------------------------------------
13:58 andre@LonLT093 ~/Desktop/Fann/fann-2.1.0/examples% cat
sample_ruby.rb
require 'rubygems'
require 'ruby_fann/neural_network'

# Create Training data with 2 each of inputs(array of 3) & desired
outputs(array of 1).
training_data = RubyFann::TrainData.new(
:inputs=>[[0.3, 0.4, 0.5], [0.1, 0.2, 0.3]],
:desired_outputs=>[[0.7], [0.8]])

# Create FANN Neural Network to match appropriate training data:
fann = RubyFann::Standard.new(
:num_inputs=>3,
:hidden_neurons=>[2, 8, 4, 3, 4],
:num_outputs=>1)

# Training using data created above:
fann.train_on_data(training_data, 1000, 1, 0.1)

puts "Hello there"

# Run with different input data:
outputs = fann.run([0.7, 0.9, 0.2])

14:02 andre@LonLT093 ~/Desktop/Fann/fann-2.1.0/examples%

Steven Miers

unread,
Nov 16, 2008, 11:27:49 PM11/16/08
to ruby...@googlegroups.com
I have noticed this as well, but haven't been able to narrow it down.
I suspect it is an incompatibility with irb, but I haven't been able
to narrow it down any further than that.

Thanks,
-Steven Miers

Steven Miers

unread,
Nov 18, 2008, 8:53:39 PM11/18/08
to ruby...@googlegroups.com
I have noticed this before as well. It seems to be a problem in irb,
but I haven't been able to narrow it down any further.

If you have any ideas or thoughts, it would be greatly appreciated.

-Steven Miers

On Nov 16, 2008, at 8:05 AM, André wrote:

>
Reply all
Reply to author
Forward
0 new messages