//запуск теста мниста private void mnistTestButton_Click(object sender, EventArgs e) { if (Information.NN == null) { printErrorMessage("NN не создана"); return; } if (Information.isMnistLearn && Information.answNames.Count == 10) { ReadMnist readMnist = new ReadMnist(false, true); string[] fileNames2 = Information.answNames.ToArray(); LoadFromFile lF2 = new LoadFromFile(fileNames2); List <List <float> > answList = lF2.ConvertIntoList(); Information.NN.MnistTest(readMnist, answList); } else { MessageBox.Show("Error Mnist Learn Not Active"); } }
//Начать учить НН private async void startLearnNN(object sender, EventArgs e) { int MaxEp; if (int.TryParse(textBoxLearnRate.Text, out MaxEp)) { Information.NN.MaxEp = MaxEp; } int DistPrint; if (int.TryParse(textBoxMoment.Text, out DistPrint)) { Information.NN.DistPrint = DistPrint; } if (Information.pattNames.Count == Information.answNames.Count && Information.pattNames.Count != 0) { string[] fileNames1 = Information.pattNames.ToArray(); LoadFromFile lF1 = new LoadFromFile(fileNames1); string[] fileNames2 = Information.answNames.ToArray(); LoadFromFile lF2 = new LoadFromFile(fileNames2); List <List <float> > pattList = lF1.ConvertIntoList(); List <List <float> > answList = lF2.ConvertIntoList(); Information.NN.Learning(pattList.Count, pattList, answList); } else if (Information.isMnistLearn && Information.answNames.Count == 10) { ReadMnist readMnist = new ReadMnist(true, false); //File.WriteAllLines("mnist_data.txt", Information.mnistStrs); string[] fileNames2 = Information.answNames.ToArray(); LoadFromFile lF2 = new LoadFromFile(fileNames2); List <List <float> > answList = lF2.ConvertIntoList(); Information.NN.LearningMnist(readMnist, answList); } else if (Information.isFormatLearn) { if (Information.NN != null) { openFileDialog1.FileName = "Выбор файла NN"; openFileDialog1.Filter = "*(*.txt)|*.txt"; openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory() + @"\formatData"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { string filePath = openFileDialog1.FileName; Information.FormatFilePath = filePath; Tuple <PatternsType, KeysType, AnswersType> data = FormatLoad(filePath); PatternsType pattList = data.Item1; KeysType keys = data.Item2; AnswersType answList = data.Item3; await Information.NN.LearningFormat(pattList, keys, answList); } else { FormConsole.PrintlnAndScroll("erroe open file dialog"); } } else { FormConsole.PrintlnAndScroll("erroe NN is not define"); } } else { printErrorMessage("Неверно заданы образцы и ответы"); } }