private void learnBtn_Click(object sender, RoutedEventArgs e) { if (network == null) { learningStatus.Content = "Stwórz najpierw sieć"; return; } if (!weightsLoaded) { learningStatus.Content = "Załaduj najpierw wagi"; return; } if (learning == null) { learningStatus.Content = "Załaduj najpierw próbki uczące"; return; } if (!FormValidation.isBetaValid(betaBox, out string betaMessage)) { learningStatus.Content = betaMessage; return; } if (!FormValidation.isLearningFactorValid(learningFactorBox, out string LearningFactorMessage)) { learningStatus.Content = LearningFactorMessage; return; } if (!FormValidation.isEpochAmountValid(epochAmountBox, out string epochMessage)) { learningStatus.Content = epochMessage; return; } epochAmount = int.Parse(epochAmountBox.Text); beta = double.Parse(betaBox.Text); learningFactor = double.Parse(learningFactorBox.Text); BackgroundWorker worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.ProgressChanged += worker_ProgressChanged; worker.DoWork += worker_DoWork; if (worker.IsBusy == true) { learningStatus.Content = "Poczekaj na zakończenie procesu uczenia"; return; } progressBar.Visibility = Visibility.Visible; worker.RunWorkerAsync(); }
private void outputBtn_Click(object sender, RoutedEventArgs e) { if (network == null) { resultBox.Text = "Najpierw stwórz sieć"; return; } if (!FormValidation.isBetaValid(inputBetaBox, out string message)) { resultBox.Text = message; return; } if (!FormValidation.isInputValid(configuration, inputBox, out string inputMessage)) { resultBox.Text = inputMessage; return; } if (!FormValidation.isMinValid(minBox, out string minMessage)) { resultBox.Text = minMessage; return; } if (!FormValidation.isMaxValid(minBox, out string maxMessage)) { resultBox.Text = maxMessage; return; } double min = double.Parse(minBox.Text); double max = double.Parse(maxBox.Text); double inputBeta = double.Parse(inputBetaBox.Text); var inputs = Tools.convertStringToDoubleList(inputBox.Text); double output = network.calculateOutput(inputs, inputBeta); double denormalizedOutput = Tools.getDenormalizedValue(output, min, max); resultBox.Text = denormalizedOutput.ToString(); }