예제 #1
0
        public long Epoch(Epochs epoch)
        {
            switch (mode)
            {
            case TimeMode.LocalTime:
                return(0);
            }

            switch (epoch)
            {
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
            case Epochs.Day:
                return(HighResolutionDateTime.ToMicroseconds(DateTime.Today));
#endif
            default:

                throw new NotImplementedException();
            }
        }
예제 #2
0
        private void ExecuteTraining(CancellationToken token)
        {
            _dispatcher.Invoke(() => Epochs.Clear());

            if (!_patternContainer.Patterns.Any())
            {
                MessageBox.Show("Brak danych do uczenia!");
                return;
            }

            string trainFile = $@"{DateTime.Now:yyyyMMddHHmmss}.train";
            string testFile  = $@"{DateTime.Now:yyyyMMddHHmmss}.test";

            _patternContainer.SaveToFann(trainFile, testFile, SetDivisionRatio);

            _network.NumberOfInputs  = (uint)_patternContainer.Patterns.First().Pixels.Length;
            _network.NumberOfOutputs = (uint)_patternContainer.Patterns.GroupBy(x => x.Name).Count();

            _network.Train(trainFile, MaxIterations, IterationsBetweenReports, LearningRate, DesiredError, (epochs, cost) =>
            {
                _dispatcher.Invoke(() =>
                {
                    Epochs.Add(new EpochInfo
                    {
                        Number = epochs,
                        Error  = cost,
                    });

                    CurrentError = cost;
                });

                token.ThrowIfCancellationRequested();
            });

            Log += $"[{DateTime.Now}] Błąd zbioru testowego: {_network.Test(testFile)}\n";
        }
 public void Clear()
 {
     Epochs.Clear();
     NodesVotes.Clear();
 }