AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Wrong Lenght of input vector?

The forum is to discuss topics from different artificial intelligence areas, like neural networks, genetic algorithms, machine learning, etc.

Wrong Lenght of input vector?

Postby Audio » Sat Nov 07, 2009 8:05 pm

I know ive been posting quite a bit on here lately, but Im still somewhat confused about this. I have a set of training data for my network, and the networks inputs count matches the amount of data, but when i try to use RunEpoch, it errors on me saying my Input vector length is wrong. Any idea why this could be?
Audio
 
Posts: 5
Joined: Thu Oct 15, 2009 1:08 am

Re: Wrong Lenght of input vector?

Postby fabio.caversan » Sun Nov 08, 2009 4:31 pm

Hi there,

The network input count must match the size of ONE input. Then yuo can have several inputs, and they do not need to match the number of neurons in input layer. Probablly you mixed up those two things. You can make a simple test, try to train the network just for one input-output case.

If this is not the case, post the network and input specirfications, maybe some code, and maybe we can help a little more.

Regards,

Caversan
fabio.caversan
 
Posts: 40
Joined: Mon Jan 26, 2009 6:10 pm

Re: Wrong Lenght of input vector?

Postby riba_net » Tue May 17, 2011 1:29 pm

Can my output array count be higher than input array?

For example, if I change the input/output in the XOR example:

Code: Select all
// initialize input and output values
            double[][] input = new double[4][] {
                new double[] {0, 0}, new double[] {0, 1},
                new double[] {1, 0}, new double[] {1, 1}
            };
                        double[][] output = new double[4][] {
                new double[] {0}, new double[] {1},
                new double[] {1}, new double[] {0}
            };

            // create neural network
            ActivationNetwork network = new ActivationNetwork(
                new SigmoidFunction(),
                2, // two inputs in the network
                2, // two neurons in the first layer
                1); // one neuron in the second layer                 

            // create teacher
            BackPropagationLearning teacher = new BackPropagationLearning(network);

            // loop
            int attempts = 0;
            while (attempts <= 10)
            {
                // run epoch of learning procedure
                double error = teacher.RunEpoch(input, output);
                attempts++;
            }
riba_net
 
Posts: 13
Joined: Wed May 11, 2011 8:58 pm

Re: Wrong Lenght of input vector?

Postby andrew.kirillov » Tue May 17, 2011 4:41 pm

riba_net wrote:Can my output array count be higher than input array?

One output aray per one input array. It should be obvious.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3446
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to Artificial Intelligence