IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 27, 2018, 1:09:32 PM (8 years ago)
Author:
eugene
Message:

updated nnet to include better init, L2 regularization, cross-entropy cost function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.data/nnet.c

    r40320 r40325  
    143143}
    144144
    145 void CreateNnetData (Nnet *nnet) {
     145void CreateNnetData (Nnet *nnet, int LargeWeightInit) {
    146146
    147147  ohana_gaussdev_init ();
     
    168168    }
    169169
     170    float sigma = LargeWeightInit ? 1.0 : 1.0 / sqrt(nnet[0].Nnodes[i-1]);
     171
    170172    ALLOCATE (nnet[0].weight[i], float, nnet[0].Nnodes[i-1]*nnet[0].Nnodes[i]);  // weight connected each node in the previous layer to the current layer (excludes input layer)
    171173    for (int j = 0; j < nnet[0].Nnodes[i-1]*nnet[0].Nnodes[i]; j++) {
    172       nnet[0].weight[i][j] = ohana_gaussdev_rnd (0.0, 1.0);
     174      nnet[0].weight[i][j] = ohana_gaussdev_rnd (0.0, sigma);
    173175    }
    174176
Note: See TracChangeset for help on using the changeset viewer.