How does ffnet handle normalization of a single variable?

pywx
2013-08-09
2013-08-10
  • pywx
    pywx
    2013-08-09

    I am working on some code to run a saved ffnet neural network in python without having to use the ffnet module. However, i got stuck while trying to figure out how normalization works.

    According to the documentation, the inputs are normalized from -0.15 to 0.85. However, if i try to train a neural network with three samples:
    [3,4,5] -> [0,0,2]
    [6,4,2] -> [0,2,1]
    [9,4,1] -> [1,3,0]
    How will numpy handle normalization of the second element in the input lists? only the value 4 appears.

    Also i have another question about how normalization of the outputs work. If you normalize them all to (-0.15,0.85) but the range of the sigmoid function is (0,1) then how does the neural network output negative values?

    I've tried to read the fortran code for setin and getout, but i'm not familiar with it so i just get confused.

    Thanks for any help!

     
    Last edit: pywx 2013-08-09
  • Marek
    Marek
    2013-08-10

    Hi!

    Normalization is done to the range (0.15, 0.85). Where did you find -0.15? This should be corrected...

    Coefficients of linear map are calculated by simple function _linear:

    from ffnet import ffnetmodule
    a, b = ffnetmodule._linear(vecmin, vecmax, 0.15, 0.85) # normalize
    A, B = ffnetmodule._linear(0.15, 0.85, vecmin, vecmax) # de-normalize
    

    For input with single value only (4 in your example) you will get a=0 and b=0.5 (b in the middle of the range (0.15, 0.85)). Such inputs should be avoided though...

     
    Last edit: Marek 2013-08-10
  • pywx
    pywx
    2013-08-10

    Thanks for the reply!

    I must've been seeing things and somehow read the 0.15 as -0.15. Anyways that solves the dilemma and my question. Thank you!