Giter VIP home page Giter VIP logo

ruby-fann's Introduction

Altruistic AI

ruby-fann's People

Contributors

agentydragon avatar git-steven avatar oleschoenburg avatar scottlingran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-fann's Issues

Automatic Input/Output size

Would you be open to a PR implementing an initializer which you give the train data and it detects the desired input and output size automatically? Would love to implement this!

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

  spec.license = 'MIT'
  # or
  spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

1.4.1 gem fails to build on Debian

When trying to install the ruby-fann 1.4.1 gem using
$ gem install ruby-fann

on my Debian 10.13 box with gcc 8.3.0, I get the following error:

Building native extensions. This could take a while...
ERROR:  Error installing ruby-fann:
	ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/ruby-fann-1.4.1/ext/ruby_fann
/usr/bin/ruby2.5 -r ./siteconf20230828-10282-13n5rst.rb extconf.rb
checking for doublefann.h... yes
creating Makefile

current directory: /var/lib/gems/2.5.0/gems/ruby-fann-1.4.1/ext/ruby_fann
make "DESTDIR=" clean

current directory: /var/lib/gems/2.5.0/gems/ruby-fann-1.4.1/ext/ruby_fann
make "DESTDIR="
compiling doublefann.c
In file included from doublefann.c:26:
fann_io.c: In function ‘fann_save_internal_fd’:
fann_io.c:285:22: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long int’ [-Wformat=]
     fprintf(conf, "(%u, %u, %u) ", neuron_it->last_con - neuron_it->first_con,
                     ~^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     %lu
fann_io.c:291:22: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long int’ [-Wformat=]
     fprintf(conf, "(%u, %u, " FANNPRINTF ") ", neuron_it->last_con - neuron_it->first_con,
                     ~^                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     %lu
In file included from doublefann.c:29:
fann_error.c: In function ‘fann_error’:
fann_error.c:201:2: error: format not a string literal and no format arguments [-Werror=format-security]
  rb_raise (rb_eRuntimeError, errstr);
  ^~~~~~~~
cc1: some warnings being treated as errors
make: *** [Makefile:243: doublefann.o] Error 1

make failed, exit code 2

NOTE: The ruby-fann 1.4.0 gem can be successfully installed, though.

Compiler Error

Attempting to gem ins ruby-fann with Ruby v3.3.0 with latest MacOS on an M2max chip. I'm seeing compiler errors on the extension.

 $ gem install ruby-fann
Building native extensions. This could take a while...
ERROR:  Error installing ruby-fann:
  ERROR: Failed to build gem native extension.

    current directory: /Users/dewayne/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ruby-fann-2.0.2/ext/ruby_fann
/Users/dewayne/.rbenv/versions/3.3.0/bin/ruby extconf.rb
checking for doublefann.h... yes
creating Makefile

current directory: /Users/dewayne/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ruby-fann-2.0.2/ext/ruby_fann
make DESTDIR\= sitearchdir\=./.gem.20240401-60867-cly9bi sitelibdir\=./.gem.20240401-60867-cly9bi clean

current directory: /Users/dewayne/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ruby-fann-2.0.2/ext/ruby_fann
make DESTDIR\= sitearchdir\=./.gem.20240401-60867-cly9bi sitelibdir\=./.gem.20240401-60867-cly9bi
compiling ruby_fann.c
In file included from ruby_fann.c:3:
In file included from ./doublefann.h:31:
./fann.h:116:6: warning: '_MSC_VER' is not defined, evaluates to 0 [-Wundef]
#if (_MSC_VER > 1300)
     ^
In file included from ruby_fann.c:5:
./fann_augment.h:84:20: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
                i, RARRAY_LEN(inputs_i)),
                   ^~~~~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/core/rarray.h:51:36: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN                 rb_array_len                 /**< @alias{rb_array_len} */
                                   ^
In file included from ruby_fann.c:5:
./fann_augment.h:83:69: warning: more '%' conversions than data arguments [-Wformat-insufficient-args]
                "Number of inputs at [%d] is inconsistent: (%du != %d)",
                                                                   ~^
./fann_augment.h:93:20: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
                i, RARRAY_LEN(outputs_i)),
                   ^~~~~~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/core/rarray.h:51:36: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN                 rb_array_len                 /**< @alias{rb_array_len} */
                                   ^
In file included from ruby_fann.c:5:
./fann_augment.h:92:69: warning: more '%' conversions than data arguments [-Wformat-insufficient-args]
                "Number of outputs at [%d] is inconsistent: (%d != %d)",
                                                                   ~^
ruby_fann.c:378:33: error: incompatible integer to pointer conversion passing 'VALUE' (aka 'unsigned long') to parameter of type 'void *' [-Wint-conversion]
        fann_set_user_data(ann, self);
                                ^~~~
./fann.h:544:72: note: passing argument to parameter 'user_data' here
FANN_EXTERNAL void FANN_API fann_set_user_data(struct fann *ann, void *user_data);
                                                                       ^
ruby_fann.c:353:62: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
        unsigned int num_layers = RARRAY_LEN(hidden_neurons) + 2;
                     ~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
ruby_fann.c:834:33: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
            for (i = neuron_it->first_con; i < neuron_it->last_con; i++)
                   ~ ~~~~~~~~~~~^~~~~~~~~
ruby_fann.c:836:73: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                rb_ary_push(connection_array, INT2NUM(f->connections[i] - f->first_layer->first_neuron));
                                              ~~~~~~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ruby_fann.c:1173:24: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
    unsigned int len = RARRAY_LEN(inputs);
                 ~~~   ^~~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/core/rarray.h:51:36: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN                 rb_array_len                 /**< @alias{rb_array_len} */
                                   ^
ruby_fann.c:1226:30: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
    unsigned int num_input = RARRAY_LEN(input);
                 ~~~~~~~~~   ^~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/core/rarray.h:51:36: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN                 rb_array_len                 /**< @alias{rb_array_len} */
                                   ^
ruby_fann.c:1227:31: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
    unsigned int num_output = RARRAY_LEN(expected_output);
                 ~~~~~~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/core/rarray.h:51:36: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN                 rb_array_len                 /**< @alias{rb_array_len} */
                                   ^
ruby_fann.c:1537:73: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
    fann_set_cascade_activation_functions(f, fann_activation_functions, cnt);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                               ^~~
ruby_fann.c:1593:24: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
    unsigned int cnt = RARRAY_LEN(cascade_activation_steepnesses);
                 ~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/core/rarray.h:51:36: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN                 rb_array_len                 /**< @alias{rb_array_len} */
                                   ^
ruby_fann.c:1682:5: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
    rb_define_method(m_rb_fann_standard_class, "get_neurons", get_neurons, 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/anyargs.h:288:135: note: expanded from macro 'rb_define_method'
#define rb_define_method(klass, mid, func, arity)           RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
                                                                                                                                      ^~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/anyargs.h:277:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
^
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/anyargs.h:255:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
                                                                       ^
ruby_fann.c:1780:5: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
    rb_define_method(m_rb_fann_shortcut_class, "get_neurons", get_neurons, 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/anyargs.h:288:135: note: expanded from macro 'rb_define_method'
#define rb_define_method(klass, mid, func, arity)           RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
                                                                                                                                      ^~~~~~
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/anyargs.h:277:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
^
/Users/dewayne/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/internal/anyargs.h:255:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
                                                                       ^
13 warnings and 3 errors generated.
make: *** [ruby_fann.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/dewayne/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ruby-fann-2.0.2 for inspection.
Results logged to /Users/dewayne/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/extensions/arm64-darwin-23/3.3.0/ruby-fann-2.0.2/gem_make.out
12:59:53 3.3.0  nibiru:Downloads $ e /Users/dewayne/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/extensions/arm64-darwin-23/3.3.0/ruby-fann-2.0.2/gem_make.out

init_weights

Without initializing the weights the net produces results.
After initializing it like this:

@net.init_weights( RubyFann::TrainData.new(
		inputs: [Array.new( @input_size){0.1}],
		desired_outputs: [Array.new( @input_size){0.1}]
	))

the result fom @net.run is [NaN, NaN, NaN]
Tried different values for initialization.
Any ideas?

Support for set_scaling_params gang

I am not familiar with ruby/C interface, but it seems to me support for such functions are missing. Though I can do input/output normalization myself, it would be better to have it built in.

Anyone able to get this to work?

I'm having the same problem as this guy: http://stackoverflow.com/questions/9746062/training-neural-network-in-ruby

Training doesn't do very well despite pretty predictive data:
Max epochs 1000000. Desired error: 0.0010000000.
Epochs 1. Current error: 0.7620287538. Bit fail 118.
Epochs 100000. Current error: 0.4796932936. Bit fail 195.
Epochs 200000. Current error: 0.4797259271. Bit fail 195.
Epochs 300000. Current error: 0.4799208045. Bit fail 195.
Epochs 400000. Current error: 0.4797225893. Bit fail 195.
Epochs 500000. Current error: 0.4799278677. Bit fail 195.
Epochs 600000. Current error: 0.4797178209. Bit fail 195.
Epochs 700000. Current error: 0.4796698689. Bit fail 195.
Epochs 800000. Current error: 0.4795957506. Bit fail 194.
Epochs 900000. Current error: 0.4795432389. Bit fail 194.
Epochs 1000000. Current error: 0.4797499180. Bit fail 195.

Everything is normalized obviously, otherwise we get segmentation faults.

For each train, output is always a random number that stays the same no matter the input:
2.0.0-p195 :016 > $fann.run([1])
=> [0.02257500380258881]
2.0.0-p195 :017 > $fann.run([1,5,3,2,1,4])
=> [0.02257500380258881]
2.0.0-p195 :018 > $fann.run([0.1, 0.5, 0.5, 0.5, 0.1, 0.1])
=> [0.02257500380258881]

If I re-run training, the result number is different

Segmentation fault problem

This code cause [BUG] Segmentation fault

raw_input = "
1           1
    1     1 
    1   1   

  1         1

  1         1


    1     1 
    1     1 
1         1 

1           1
1           1
  1         1

1       1   
1       1   
1       1   
1       1   
1       1   
    1   1   

  1       1 
    1   1   

  1       1 
1           1
  1         1

    1     1 
1       1   
  1     1   
    1   1   


  1     1   
    1   1   


    1     1 
1           1
    1     1 
  1     1   
  1         1



    1       1
1           1
  1       1 
  1     1   
    1     1 
1       1   
  1     1   
  1         1
"

raw_input = raw_input.split(/\n/)
raw_input = raw_input.reject{ |a| !(a =~ /1/) }
raw_input = raw_input.map{ |s| [s.index('1'), s.rindex('1')] }
winloose = {
  0 => {8 => 1, 10 => 0, 12 => 2},
  2 => {8 => 2, 10 => 1, 12 => 0},
  4 => {8 => 0, 10 => 2, 12 => 1}
}
raw_input.each{ |r| r[2] = winloose[r[0]][r[1]] }
results = raw_input[1..-1].map{ |r| r[1] }
train = RubyFann::TrainData.new(:inputs=>raw_input[0..-2], :desired_outputs=>results)

ruby-2.0.0-p481

ruby-fann gem doesn't work on 3.2.0/Ubuntu 22.04

I believe I have a clean fann and ruby-fann install.
But for some reason, the test program which I copied from this site crashes as below.

rubyai@enterprise:~/d.ruby.stuff$ apt list | fgrep fann | fgrep installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libfann-dev/jammy,now 2.2.0+ds-6 amd64 [installed]
libfann-doc/jammy,jammy,now 2.2.0+ds-6 all [installed]
libfann2/jammy,now 2.2.0+ds-6 amd64 [installed,automatic]

rubyai@enterprise:~/d.ruby.stuff$ ruby --version
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]

rubyai@enterprise:~/d.ruby.stuff$ gem pristine ruby-fann
Restoring gems to pristine condition...
Building native extensions. This could take a while...
Restored ruby-fann-1.3.2

rubyai@enterprise:~/d.ruby.stuff$ more test2.rb
require 'ruby-fann'
train = RubyFann::TrainData.new(:inputs=>[[0.3, 0.4, 0.5], [0.1, 0.2, 0.3]], :desired_outputs=>[[0.7], [0.8]])
fann = RubyFann::Standard.new(:num_inputs=>3, :hidden_neurons=>[2, 8, 4, 3, 4], :num_outputs=>1)
fann.train_on_data(train, 1000, 10, 0.1) # 1000 max_epochs, 10 errors between reports and 0.1 desired MSE (mean-squared-error)
outputs = fann.run([0.3, 0.2, 0.4])

rubyai@enterprise:~/d.ruby.stuff$ ruby test2.rb
internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:88:in require': cannot load such file -- ruby_fann/ruby_fann (LoadError) from <internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in require'
from /home/rubyai/local/lib/ruby/gems/3.2.0/gems/ruby-fann-1.3.2/lib/ruby_fann.rb:2:in <top (required)>' from <internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in require'
from internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:88:in require' from /home/rubyai/local/lib/ruby/gems/3.2.0/gems/ruby-fann-1.3.2/lib/ruby-fann.rb:1:in <top (required)>'
from internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:162:in require' from <internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:162:in rescue in require'
from internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:152:in require' from test2.rb:1:in

'
internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:88:in require': cannot load such file -- ruby-fann (LoadError) from <internal:/home/rubyai/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in require'
from test2.rb:1:in `'

Learning rate and momentum?

Hi, is there an option anywhere to specify the learning rate and / or the momentum for the training? Thanks.

One class classification using Ruby Fann?

Hey, Just wondering if it's possible to use this gem for outlier classification or the one class classification wherein I only have data for positive or negative and I want to classify the coming data if it belongs to the group or not.

If not, any such in Ruby?

Any help is appreciated.

Segmentation Fault ruby 2.7.1

I don't know if this gem is compatible with ruby 2.7.0+. But, i am receiving a massive segmentation fault when I attempt to run the rb file. Can someone please test this gem for ruby 2.7.1. I want to make sure that I'm not doing something wrong.

1.4.1 gem fails to build

gem install ruby-fann
Fetching ruby-fann-1.4.1.gem
Building native extensions. This could take a while...
ERROR: Error installing ruby-fann:
ERROR: Failed to build gem native extension.

current directory: /usr/local/lib64/ruby/gems/3.1.0/gems/ruby-fann-1.4.1/ext/ruby_fann

/usr/bin/ruby31 -I /usr/lib64/ruby/site_ruby/3.1.0 extconf.rb
checking for doublefann.h... yes
creating Makefile

current directory: /usr/local/lib64/ruby/gems/3.1.0/gems/ruby-fann-1.4.1/ext/ruby_fann
make DESTDIR= sitearchdir=./.gem.20240104-9581-49ow02 sitelibdir=./.gem.20240104-9581-49ow02 clean
rm -f
rm -fr ruby_fann.so false *.o .bak mkmf.log ..time

current directory: /usr/local/lib64/ruby/gems/3.1.0/gems/ruby-fann-1.4.1/ext/ruby_fann
make DESTDIR= sitearchdir=./.gem.20240104-9581-49ow02 sitelibdir=./.gem.20240104-9581-49ow02
clang -I. -I/usr/include/ruby-3.1.0/x86_64-linux -I/usr/include/ruby-3.1.0/ruby/backward -I/usr/include/ruby-3.1.0 -I. -DHAVE_DOUBLEFANN_H -fPIC -O2 -pipe -fno-strict-aliasing -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef -fPIC -o ruby_fann.o -c ruby_fann.c
In file included from ruby_fann.c:3:
In file included from ./doublefann.h:31:
./fann.h:116:6: warning: '_MSC_VER' is not defined, evaluates to 0 [-Wundef]
#if (_MSC_VER > 1300)
^
ruby_fann.c:307:33: error: incompatible integer to pointer conversion passing 'VALUE' (aka 'unsigned long') to parameter of type 'void ' [-Wint-conversion]
fann_set_user_data(ann, self);
^~~~
./fann.h:544:72: note: passing argument to parameter 'user_data' here
FANN_EXTERNAL void FANN_API fann_set_user_data(struct fann ann, void user_data);
^
ruby_fann.c:759:33: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
for (i = neuron_it->first_con; i < neuron_it->last_con; i++) {
~ ~~~~~~~~~~~^~~~~~~~~
ruby_fann.c:760:73: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
rb_ary_push(connection_array, INT2NUM(f->connections[i] - f->first_layer->first_neuron));
~~~~~~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ruby_fann.c:1581:5: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long)') to parameter of type 'VALUE (
)(VALUE)' (aka 'unsigned long (
)(unsigned long)') [-Wincompatible-function-pointer-types]
rb_define_method(m_rb_fann_standard_class, "get_neurons", get_neurons, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-3.1.0/ruby/internal/anyargs.h:287:135: note: expanded from macro 'rb_define_method'
#define rb_define_method(klass, mid, func, arity) RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
^~~~~~
/usr/include/ruby-3.1.0/ruby/internal/anyargs.h:276:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char )
^
/usr/include/ruby-3.1.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(VA_ARGS, VALUE(
)(VALUE), int);
^
ruby_fann.c:1681:5: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long)') to parameter of type 'VALUE (
)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
rb_define_method(m_rb_fann_shortcut_class, "get_neurons", get_neurons, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-3.1.0/ruby/internal/anyargs.h:287:135: note: expanded from macro 'rb_define_method'
#define rb_define_method(klass, mid, func, arity) RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
^~~~~~
/usr/include/ruby-3.1.0/ruby/internal/anyargs.h:276:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char )
^
/usr/include/ruby-3.1.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(VA_ARGS, VALUE(
)(VALUE), int);
^
3 warnings and 3 errors generated.
make: *** [Makefile:247: ruby_fann.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib64/ruby/gems/3.1.0/gems/ruby-fann-1.4.1 for inspection.
Results logged to /usr/local/lib64/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/ruby-fann-1.4.1/gem_make.out

Upgrade to Fann 2.2.0?

Would you be open to getting a PR upgrading Fann to 2.2.0?

I think it's really important to keep this up to date since the 64bit architecture was added to Fann.

RubyML list

Dear ruby-fann contributors,

we've recently added ruby-fann to our Awesome RubyML list: https://github.com/arbox/machine-learning-with-ruby

Ruby bindings for FANN are really important for the Ruby ML ecosystem. So we introduced the rubyml topic which connects all ML related projects written in and for Ruby.

Please consider adding the rubyml topic to your repository :)

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.