コード例 #1
0
        public void Train(object sender, DoWorkEventArgs e)
        {
            InitNetwork();
            List <List <Sample> > batches   = FormBatches();
            Stopwatch             totalTime = new Stopwatch();
            Stopwatch             stopwatch = new Stopwatch();

            stopwatch.Start();
            totalTime.Start();
            ErrorTimeline.Add(TotalError);
            _eta = Eta;
            while (!Stop && !ForcedStop && TotalError > DesiredError && Iter++ < IterationLimit && totalTime.Elapsed.TotalSeconds < TimeLimit)
            {
                if (Iter % EtaChangePeriod == 0)
                {
                    _eta -= _eta / 20;
                }
                Backpropagation(batches);
                Evaluate();
                ErrorTimeline.Add(TotalError);
                if (stopwatch.Elapsed.TotalSeconds < RefreshRate)
                {
                    continue;
                }
                UpdateInfo(_panel, _iter, _error, this);
                stopwatch.Restart();
            }
            e.Result = ForcedStop;
        }
コード例 #2
0
 public void ResetTraining()
 {
     TotalError = 0;
     Iter       = 0;
     ErrorTimeline.Clear();
     if (_architecture is null)
     {
         return;
     }
     for (int i = 0; i < NumberOfLayers; i++)
     {
         _layers[i].ResetLayer();
     }
 }