private void btnStop_Click(object sender, EventArgs e) { if (textParas.Text.Length < 1) { MessageBox.Show("Para Setting Is Empty"); return; } if (textTraingInputs.Lines.Length < 1) { MessageBox.Show("Test Input Is Empty"); return; } ANNWrapper.LoadBPParameters(Application.StartupPath + "\\" + textParas.Text); //ANNWrapper.PrintBPParameters("C:\\TypePara.text"); double[] inputs = new double[64]; double[] dests = new double[4]; int divideFactor = Int32.Parse(textParaFactor.Text); int matchCount = 0; Random rand = new Random(); Double noiseFactor = Double.Parse(textNoiseFactor.Text); foreach (string line in textTraingInputs.Lines) { string[] strs = line.Split(','); if (strs.Length != 65) { continue; } for (int i = 0; i < 64; i++) { inputs[i] = Double.Parse(strs[i]) / divideFactor; } //Add Noise Factor to Input int noiseCount = Int32.Parse(textNoiseCount.Text); for (int i = 0; i < noiseCount; i++) { inputs[rand.Next(0, 63)] = noiseFactor; } /* string dest = Convert.ToString(Int32.Parse(strs[64]), 2);*/ for (int i = 0; i < 4; i++) { dests[i] = 0.0; } if (!ANNWrapper.Recognition(inputs, dests)) { MessageBox.Show("Recognition Error:" + line); continue; } Int32 dest = 0; if (dests[0] > 0.5) { dest += 1; } if (dests[1] > 0.5) { dest += 2; } if (dests[2] > 0.5) { dest += 4; } if (dests[3] > 0.5) { dest += 8; } if (dest == Int32.Parse(strs[64])) { matchCount += 1; } else { textUnMatch.AppendText(line + "|" + dests[0].ToString() + "," + dests[1].ToString() + "," + dests[2].ToString() + "," + dests[3].ToString() + "" + "\r\n"); } } double dblRate = matchCount * 100.0 / textTraingInputs.Lines.Length; MessageBox.Show("%" + dblRate.ToString() + "(" + matchCount.ToString() + "/" + textTraingInputs.Lines.Length + ")"); }