Exemplo n.º 1
0
 public void PreTrain(INNInputProvider PProvider, int PWhichWeightSet)
 {
     double[] input = PProvider.NextInputCase();
     double[] posvis;
     double[] poshid;
     double[] negvis;
     double[] neghid;
     GetPreTrainData(PWhichWeightSet, input, out posvis, out poshid, out negvis, out neghid);
     PerformPreTraining(PWhichWeightSet, posvis, poshid, negvis, neghid);
 }
Exemplo n.º 2
0
 public void CalculateDiagonalHessian(INNInputProvider PProvider, int PHessianBatchLength)
 {
     double[][] input   = new double[PHessianBatchLength][];
     double[][] desired = new double[PHessianBatchLength][];
     for (int i = 0; i < PHessianBatchLength; i++)
     {
         input[i]   = PProvider.NextInputCase();
         desired[i] = PProvider.DesiredOutput();
     }
     double[][][] output = GetOutputFromInputsBatch(input);
     diagonalhessian = GetDerivativesFromOutputBatch(TDerivative.Second, output, input, desired);
     PProvider.Rewind(PHessianBatchLength);
 }
Exemplo n.º 3
0
 public override void Train(INNInputProvider PProvider)
 {
     double[]     input       = PProvider.NextInputCase();
     double[][]   output      = GetOutputFromInputs(input);
     double[][][] derivatives = GetDerivativesFromOutput(TDerivative.First, output, input, PProvider.DesiredOutput());
     for (int i = 0; i < numlayers; i++)
     {
         for (int j = 0; j < layers[i].NumNeurons; j++)
         {
             int numweightsback = weights[i][j].GetLength(0);
             for (int k = 0; k < numweightsback; k++)
             {
                 derivatives[i][j][k] *= (-learnrates[i]) / (diagonalhessian[i][j][k] + blowuppreventer);
             }
             derivatives[i][j][numweightsback] *= (-learnrates[i]) / (diagonalhessian[i][j][numweightsback] + blowuppreventer);
         }
     }
     ModifyWeights(derivatives);
 }
Exemplo n.º 4
0
 public override void Run(INNInputProvider PProvider)
 {
     ProcessNetwork(PProvider.NextInputCase());
 }