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(); }