Beispiel #1
0
        private void StartResume(object o)
        {
            if (_trainer.IsTraining && _trainer.IsPaused)
            {
                _trainer.Resume();
            }
            else if (!_trainer.IsTraining)
            {
                _tokenSource  = new CancellationTokenSource();
                _trainingTask = _trainer.Train(_tokenSource.Token);
            }

            OptionsModel.PauseCommand.RaiseCanExecuteChanged();
            OptionsModel.StartResumeCommand.RaiseCanExecuteChanged();
        }
Beispiel #2
0
        private void TrainXor(LayeredNet <float> net)
        {
            var trainer = new OptimizingTrainer <float>(net, net.Optimizer, new XorDataset(true), new OptimizingTrainerOptions(1)
            {
                ErrorFilterSize = 0,
                ReportProgress  = ActionSchedule.Disabled,
                ReportMesages   = false
            }, new OptimizingSession(false));

            var cts = new CancellationTokenSource();

            trainer.SequenceTrained += s =>
            {
                cts.Cancel();
            };

            trainer.Train(cts.Token).Wait();
        }