Ejemplo n.º 1
0
        public void TrainPerceptron()
        {
            this.x1tDaZE2v = false;
            int num1 = 0;
            int num2 = 0;
            int num3 = 0;

label_1:
            do
            {
                do
                {
                    for (int index = 0; index < this.fNBatch; ++index)
                    {
                        TNeuralData data = this.tD5M1LlFx.GetData();
                        this.fInput  = data.Input;
                        this.fTarget = data.Output;
                        this.FeedForward();
                        this.ComputeError();
                        this.FeedBackward();
                    }
                    this.Update(0);
                    TPerceptron tperceptron = this;
                    int         num4        = tperceptron.fNPattern + this.fNBatch;
                    tperceptron.fNPattern = num4;
                    num1 += this.fNBatch;
                    num2 += this.fNBatch;
                    if (this.x1tDaZE2v)
                    {
                        Console.WriteLine("");
                        return;
                    }
                    else if (this.fSMethod == EStoppingMethod.PatternNumber && (double)num1 >= this.fSParameter)
                    {
                        Console.WriteLine("", this.fSParameter);
                        return;
                    }
                }while (num2 < this.fNGraphUpdate);
                num2           = 0;
                this.wm8s050QY = this.GetTrainingSetError();
                this.V8laR9xb7.Add((double)num3, this.wm8s050QY);
                if (this.WKl1lduPx != null)
                {
                    this.MSg9cpEpW = this.GetValidationSetError();
                    this.XOwvCEen2.Add((double)num3, this.MSg9cpEpW);
                }
                ++num3;
            }while (this.fViewMode != EViewMode.OnLine);
            goto label_1;
        }
Ejemplo n.º 2
0
        public void AddHiddenLayer(int NHidden)
        {
            TNeuralLayer Layer1 = (TNeuralLayer)this.rCHgEckPw[this.rCHgEckPw.Count - 1];
            TNeuralLayer Layer2 = (TNeuralLayer) new THiddenNeuralLayer(NHidden);

            this.fOutputLayer.Disconnect(Layer1);
            this.fOutputLayer.Connect(Layer2);
            Layer2.Connect(Layer1);
            this.rCHgEckPw.Add((object)Layer2);
            ++this.HnCyxyTcM;
            this.kB5uny9D9 += NHidden;
            this.fMaxNX     = Math.Max(this.fMaxNX, NHidden + 1);
            TPerceptron tperceptron = this;
            int         num         = tperceptron.fMaxNY + 1;

            tperceptron.fMaxNY = num;
        }