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

## Input scaling in the TimeSeries sample

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

### Input scaling in the TimeSeries sample

I have a question about input scaling.

In the TimeSeries sample of this library, you multiply the input with a "data transformation factor" which is defined as "1.7 / chart height" and then subtract "0.85" from it.

Code: Select all
`double factor = 1.7 / chart.RangeY.Length;`

Code: Select all
`input[i][j] = ( data[i + j] - yMin ) * factor - 0.85;`

What are the numbers 1.7 and 0.85 ? I guess there's a just a mathematical concept I'm missing, but I've been unable to comprehend it.
Motig

Posts: 3
Joined: Sat Dec 01, 2012 8:13 am

### Re: Input scaling in the TimeSeries sample

I just realized 0.85 = 1.7 / 2

That led me to think what is the meaning of the number 1.7 .... and I came to a conclusion that it is somehow related to the fact that the bipolar sigmoid range's length is 2 (from -1 to +1) ...

And the reason of subtracting 0.3 from 2 has something to do with scaling the input not to the exact range of -1 to 1 but to -0.7 to +0.7 and I know I have already read why is it good to do so but I don't remember...but I'm going to experiment and see what's going to happen.

Well, at least, writting it down has made me answer it myself, sorry for spamming your forums :D
Motig

Posts: 3
Joined: Sat Dec 01, 2012 8:13 am

### Re: Input scaling in the TimeSeries sample

The [-0.85, 0.85] range was used in that sample for mapping training data. The idea was (not sure if that proved to work well) to give network a chance to predict beyond that range. If you would map all training data to [-1, 1], then the network would never predict anything which is smaller/greater then the smallest/greatest number in the training set.
With best regards,
Andrew

Interested in supporting AForge.NET Framework?

andrew.kirillov

Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

### Re: Input scaling in the TimeSeries sample

for compute y after learn neural net using yfactor, but how compute y if i using train net and i have only one x.then y factor i dont know, because i have only x, and xfactor = 2.0 / 1; and xmin = null ,because i input only one number. finally, how use net after learning, if i have only one input and i want comput one output?
ganjawar

Posts: 6
Joined: Tue Nov 11, 2014 1:48 pm