AForge.NET

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

multidimensional BP training

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

multidimensional BP training

Postby birkan » Tue Mar 16, 2010 3:35 pm

Hi Folks,

I need to train an ANN network from a multidimensional data for approximation. I had a look at the input data in the example and it's single dimensional. Therefore, the range etc would be redundant for me. Each data point I have (in a set of 50 data points) is a 14 dimensional integer vector and a corresponding performance (y) value. I am a bit confused about the Xfactor, xrange, yfactor and so on...

I would be pleased if anyone can tell me how I should modify the Neural network in the framework.

Thanks in advance.
birkan
 
Posts: 3
Joined: Tue Mar 16, 2010 3:29 pm

Re: multidimensional BP training

Postby andrew.kirillov » Wed Mar 17, 2010 9:50 am

Hello,

birkan wrote:I would be pleased if anyone can tell me how I should modify the Neural network in the framework.

You don't need to change anything in the framework. If your application is based on some of the samples given with framework, then you may need to do some modifications there, but not in the framework.

The issue you have is simply solved by extending input vectors for ANN. If in one dimensional case you pass an input vector, which looks something like {x1, x2, ... xn}, then for two dimensional case you may pass something like {x1, x2, ... xn, y1, y2, yn}. For ANN there is no difference how many dimensions you have. So just pass all input variables as single one dimensional arrays.
With best regards,
Andrew


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

Re: multidimensional BP training

Postby birkan » Thu Mar 18, 2010 10:29 am

Thanks Andrew,

I actually do not get these; particularly passing as a one dimensional array and "data transformation factor". Is these x,y Factors are for charting only?
From modification what I meant was this:

Code: Select all
// number of learning samples
// here the data will be formed by 50 data points with 14D input with corresponding target values.
int samples = data.GetLength( 0 );   

//these remains.
double[][] input = new double[samples][];
double[][] output = new double[samples][];

for ( int i = 0; i < samples; i++ )
{
   input[i] = new double[1];   //Should I be using a double[14] here instead?
   output[i] = new double[1];  //just the target values.

   // set input
   input[i][0] = ( data[i, 0] - xMin ) * xFactor - 1.0;
   // set output
   output[i][0] = ( data[i, 1] - yMin ) * yFactor - 0.85;
}


Thanks,

Birkan
birkan
 
Posts: 3
Joined: Tue Mar 16, 2010 3:29 pm

Re: multidimensional BP training

Postby andrew.kirillov » Thu Mar 18, 2010 10:56 am

Those factors have nothing to do with charting, but with normalizing input/output data into required range, like [-1, 1].
With best regards,
Andrew


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

Re: multidimensional BP training

Postby birkan » Tue Mar 30, 2010 3:23 pm

Alright, it all comes down to this actually:
I am working on the Approximation example. I have data some thing like this:

x1, x2, x3 :y
2, 3, 4 :6
5, 4, 22 :18
8, 1, 6 :9
....

The xi's are the decision variables (so input), and y is the corresponding performance measured. I want to develop the network for this.
From what you said, I understood I should be passing {2,3,4,6} as a data point, and parsing it to double[][3] input and double[] [1] output. Is this right?
What confuses me here is the scaling inputs. Would it deteriorate the performance a lot if I scale only the output'?

Thanks
birkan
 
Posts: 3
Joined: Tue Mar 16, 2010 3:29 pm

Re: multidimensional BP training

Postby andrew.kirillov » Wed Mar 31, 2010 9:33 am

birkan wrote:From what you said, I understood I should be passing {2,3,4,6} as a data point, and parsing it to double[][3] input and double[] [1] output. Is this right?

If you want to train network to provide 6 when it is presented with 2, 3, 4, then yes - you are right. "2, 3, 4" should be come 3 inputs, but "6" is desired output.

birkan wrote:What confuses me here is the scaling inputs. Would it deteriorate the performance a lot if I scale only the output'?

Scaling for output is a must. If you use bipolar sigmoid function, for example, with [-1, 1] range, then output should be scaled in that range. It is preferred to scale input, but there is not such hard constraint. However, if you don't scale inputs at all, your network may learn very slowly or not to learn at all. The problem is that if you use large un-scaled values, then sigmoid function will provide -1 or 1 most of the time and derivative will be 0. So no learning will occur.
With best regards,
Andrew


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




Return to Artificial Intelligence