UPDATE: Workaround->use other AI module (AI::NeuralNet::SOM).
I am trying to pass an array reference to the AI::NeuralNet::Kohonen module but it is telling me that the input is undefined. The following code shows the gist of the input (it's a bit more complicated and is actually in a subroutine, but that is not relevant to the problem).
use strict;
use warnings;
use AI::NeuralNet::Kohonen;
push @inputs, [41 scalar entries go here];
# the above statement is actually in a loop
my $input_ref = \@inputs;
I then try to throw it in the module and train it:
our $som = AI::NeuralNet::Kohonen->new(
map_dim_x => $map_dim_x, # 39
map_dim_y => $map_dim_y, # 19
epochs => $epochs, # 100
input => $input_ref
);
$som->train();
Then I get the following error:
{weight_dim} not set at /home/gotszlin/perl/lib/perl5/site_perl/5.8.5/
+/AI/NeuralNet/Kohonen.pm line 209
AI::NeuralNet::Kohonen::new('AI::NeuralNet::Kohonen', 'map_dim_x', 39,
+ 'map_dim_y', 19, 'epochs', 10, 'input', 'ARRAY(0x926af84)', ...) cal
+led at system_net.pl line 50
NSTAD_net::som_train(39, 19, 10, 'ARRAY(0x926af84)', 'my_first_som
+.txt') called at system_main.pl line 35
Can't call method "train" on an undefined value at system_net.pl line
+56.
I don't think that the weight_dim not being set has anything to do with it. I have tried other possibilities like passing @$input_ref, but that doesn't solve it. What am I doing wrong?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.