// Тестування навчальної вибірки (BackPropagation) private void TestTrain_Click(object sender, EventArgs e) { if (bpn == null) { MessageBox.Show("Спочатку створіть мережу або завантажте її із файла"); } else { ResultTrainBackPropagation = new DataTable(); this.TrainResults.DataSource = ResultTrainBackPropagation; // Створення колонок ResultTrainBackPropagation.Columns.Add("id"); for (int i = 0; i < PARAMETERS; i++) { ResultTrainBackPropagation.Columns.Add(ParametersNames[i]); } ResultTrainBackPropagation.Columns.Add("Кластер"); for (int i = 0; i < TRAINING_PATTERNS; i++) { DataRow row = ResultTrainBackPropagation.NewRow(); row[0] = i + 1; for (int k = 0; k < PARAMETERS; k++) { row[k + 1] = inputs[i][k]; } row["Кластер"] = bpn.getCluster(inputs[i], output); ResultTrainBackPropagation.Rows.Add(row); } } }
public int TestNetwork(double[] test) { int result; double[] output = new double[1]; result = bpn.getCluster(test, output); return(result); }
public string Calculate(Kerogen ker) { BackPropagationNetwork bpn = new BackPropagationNetwork("test backpropagation network.xml"); double[] inputs = new double[5]; double[] output = new double[1]; inputs[0] = ker.Carbon; inputs[1] = ker.Hydrogen; inputs[2] = ker.Oxygen; inputs[3] = ker.Nitrogen; inputs[4] = ker.Sulfur; int result = 5; result = bpn.getCluster(inputs, output); return("<br/><h2>Даний кероген відноситься до " + result.ToString() + " типу"); }