public Simple(XLSReader Reader) { foreach (var obj in Reader.ReadHeaders(4)) { continue; } countParams = 20; Valuyer = new Dictionary <int, Dictionary <string, int> >(); NetWorker = new NeuroNetWorker("SimpleMethod" + Reader.FileName, countParams, edge: false); P = 0; N = 0; TP = 0; FP = 0; TN = 0; FN = 0; }
private void CalculateStat(XLSReader Reader, int row, int result) { N++; foreach (var obj in Reader.ReadColumn(row, columnStop: 1)) { if (result.ToString() == obj.Item2) P++; if (result == 1 && obj.Item2 == "1") TP++; if (result == 0 && obj.Item2 == "0") TN++; if (result == 1 && obj.Item2 == "0") FP++; if (result == 0 && obj.Item2 == "1") FN++; } }
public void Train(XLSReader Reader, List<int> sample) { double[,] xy = new double[sample.Count, objPreparator.Count + 1]; int i = 0, j = 0; foreach (int index in Reader.ReadRow(true, sample)) { foreach (var obj in Reader.ReadColumn(index, 4)) { xy[i, j] = objPreparator.GetValue(obj.Item1, obj.Item2); j++; } foreach (var obj in Reader.ReadColumn(index, columnStop: 1)) xy[i, j] = double.Parse(obj.Item2); i++; j = 0; } NetWorker.Training(xy, sample.Count); }
public void Train(XLSReader reader, List <int> sample) { double[,] xy = new double[sample.Count, countParams + 1]; int i = 0, j = 0; foreach (int index in reader.ReadRow(true, sample)) { foreach (var obj in reader.ReadColumn(index, 4)) { xy[i, j] = Contactor(obj.Item1, obj.Item2); j++; } foreach (var obj in reader.ReadColumn(index, columnStop: 1)) { xy[i, j] = Contactor(obj.Item1, obj.Item2); } i++; j = 0; } NetWorker.Training(xy, sample.Count); }
public List <Viewer> Analyze(XLSReader Reader, List <int> sample) { P = 0; N = 0; TP = 0; FP = 0; TN = 0; FN = 0; List <Viewer> resList = new List <Viewer>(); StringBuilder inputString = new StringBuilder(); StringBuilder storesString = new StringBuilder(); double[] input = new double[countParams]; double[] result; int index; foreach (int i in Reader.ReadRow(sample: sample)) { inputString.Clear(); storesString.Clear(); foreach (var obj in Reader.ReadColumn(i, 4)) { inputString.Append(obj.Item2 + ", "); input[obj.Item1 - 4] = Contactor(obj.Item1, obj.Item2); storesString.Append(input[obj.Item1 - 4] + ", "); } result = NetWorker.Process(input); index = result[0] >= 0.5 ? 0 : 1; CalculateStat(Reader, i, index); inputString.Remove(inputString.Length - 2, 2); storesString.Remove(storesString.Length - 2, 2); resList.Add(new Viewer { Input = inputString.ToString(), Prep = storesString.ToString(), Res = index.ToString() }); } return(resList); }
private void FileLoad_Click(object sender, RoutedEventArgs e) { string fileName = OpenFile(); if (String.IsNullOrWhiteSpace(fileName)) { MessageBox.Show("Ошибка выбора файла"); return; } FileLoad.IsEnabled = false; FileClose.IsEnabled = true; SimpleMethod.IsEnabled = true; MiddleMethod.IsEnabled = true; CaseMethod.IsEnabled = true; Reader = new XLSReader(fileName); CreateSampleList(400); simple = new Simple(Reader); //average = new АverageMethod(Reader); //caseMethod = new Case(Reader); CreateSampleList(400); CreateSample.IsEnabled = true; }