コード例 #1
0
ファイル: BP.cs プロジェクト: rainbowchang/NeuralNetwork
 private void TrainingOnce()
 {
     for (int a = 0; a < this.Loops; a++)
     {
         Calculate();
         CalculateError();
         if (Delta > Constants.MaxError)
         {
             throw new ConvergenceException("So much error, stop training.");
         }
         CalculateDelta_Hidden_Output_Coefficient();
         CalculateDelta_Input_Hidden_Coefficient();
         Hidden_Output_Coefficient_Matrix.add(Hidden_Output_Coefficient_Change_Matrix);
         Input_Hiddene_Coefficient_Matrix.add(Input_Hidden_Coefficient_Change_Matrix);
         Hidden_Offset_Vector.add(Hidden_Offset_Chang_Vector);
         Output_Offset_Vector.add(Output_Offset_Change_Vector);
         //if (Delta < Constants.MinError)
         //    break;
     }
     Constants.AppendLogBoxAction("Delta = " + Delta);
 }
コード例 #2
0
 public override void Training(Vector Input_Vector, Vector Template_Vector, int Loops)
 {
     this.Input_Layer_Vector = Input_Vector;
     this.Template_Vector    = Template_Vector;
     for (int a = 0; a < Loops; a++)
     {
         Calculate();
         CalculateError();
         if (Delta > 1000000.0)
         {
             throw new Exception("So much error, stop training.");
         }
         CalculateDelta_Hidden_Output_Coefficient();
         CalculateDelta_Input_Hidden_Coefficient();
         Hidden_Output_Coefficient_Matrix.add(Hidden_Output_Coefficient_Change_Matrix);
         Input_Hiddene_Coefficient_Matrix.add(Input_Hidden_Coefficient_Change_Matrix);
         Output_Offset_Vector.add(Output_Offset_Change_Vector);
         if (Delta < 0.00000001)
         {
             break;
         }
     }
 }