private void FillLearningAlgorithmsTable(string NeuroNetName, string SelectionName) { dgwLA.Rows.Clear(); string[] names = LearningAlgorithmsLibrary.GetAllNamesOfAlgorithms(); for (int i = 0; i < LearningAlgorithmsLibrary.CountAlgorithms; i++) { dgwLA.Rows.Add(names[i]); } List <string> ls = learningInfo.FindData(NeuroNetName).FindData(SelectionName); for (int i = 0; i < dgwLA.Rows.Count; i++) { string laName = dgwLA.Rows[i].Cells[0].Value.ToString(); string laType = LearningAlgorithmsLibrary.GetNameOfTypeOfAlgoritm(laName); bool isConsist = false; foreach (string item in ls) { if (String.Compare(item, laType) == 0) { isConsist = true; break; } } if (isConsist) { dgwLA.Rows[i].Cells[1].Value = "Обучена"; } else { dgwLA.Rows[i].Cells[1].Value = "Не обучена"; } } dgwLA.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dgwLA.AutoResizeColumns(); }
public List <string> SelectLearningStatistics(string NeuroNetName, string SelectionName) { List <string> ls = new List <string>(LearningAlgorithmsLibrary.GetAllNamesOfTypesOfAlgorithms()); List <int> topologies = new List <int>(); connector.ConnectToDB(); SQLiteCommand cmd = new SQLiteCommand(connector.connection); cmd.CommandText = "SELECT NetTopology.ID FROM NetTopology, NeuroNet WHERE NeuroNetID = NeuroNet.ID AND NeuroNet.NAME = '" + Convert.ToString(NeuroNetName) + "'"; SQLiteDataReader reader = cmd.ExecuteReader(); try { while (reader.Read()) { topologies.Add(Convert.ToInt32(reader[0])); } } catch (SQLiteException ex) { MessageBox.Show(ex.Message); } reader.Close(); foreach (int item in topologies) { cmd.CommandText = "SELECT TypeLA FROM WeightsMatrix, SELECTION " + "WHERE SELECTIONID = SELECTION.ID AND SELECTION.NAME = '" + SelectionName + "' AND NetTopologyID = '" + Convert.ToString(item) + "'"; List <string> bf = new List <string>(); reader = cmd.ExecuteReader(); try { while (reader.Read()) { bf.Add(Convert.ToString(reader[0])); } } catch (SQLiteException ex) { MessageBox.Show(ex.Message); } reader.Close(); for (int i = 0; i < ls.Count; i++) { bool isConsist = false; foreach (string idBf in bf) { if (String.Compare(idBf, ls[i]) == 0) { isConsist = true; break; } } if (isConsist == false) { ls.Remove(ls[i]); i--; } } } connector.DisconnectFromDB(); return(ls); }
private void btnUse_Click(object sender, EventArgs e) { int countInputNeurons = dbHandler.SelectCountInputParametersInTask(lbTaskSelected.Text); int countOutputNeurons = 1; ActivateFunction af = LibraryOfActivateFunctions. GetActivateFunction(dbHandler.SelectActivateFunctionTypeByNeuroNet(lbNetSelected.Text), LibraryOfActivateFunctions.GetterParameter.TypeOfActivateFunctionName); List <double> valuesOfParametersAF = dbHandler.SelectValuesOfParametersOfAF(lbNetSelected.Text); int k = 0; foreach (double item in valuesOfParametersAF) { af.SetValueOfParameter(k, item); k++; } int countNeurons = dbHandler.SelectCountNeuronsInNet(lbNetSelected.Text); bool[,] connections = new bool[countNeurons, countNeurons]; double[,] weights = new double[countNeurons, countNeurons]; List <Tuple <int, int, double> > ls = dbHandler.SelectLearnedTopology(lbNetSelected.Text, lbSelSelected.Text, LearningAlgorithmsLibrary.GetNameOfTypeOfAlgoritm(lbLASelected.Text)); for (int i = 0; i < countNeurons; i++) { for (int j = 0; j < countNeurons; j++) { connections[i, j] = false; weights[i, j] = 0.0; } } foreach (Tuple <int, int, double> item in ls) { connections[item.Item2, item.Item1] = true; weights[item.Item2, item.Item1] = item.Item3; } int[] neuronsInLayers = dbHandler.SelectNeuronsInLayers(lbNetSelected.Text); NeuroNet net = new NeuroNet(countInputNeurons, countOutputNeurons, neuronsInLayers, connections, weights, af); NeuroNetSolvingWindow solvingWnd = new NeuroNetSolvingWindow(net); solvingWnd.Show(); }