static Neiron NeironCreate(Dictionary <string, object> o) {// преобразовать структуру данных в класс нейрона Neiron res = new Neiron() { Name = (string)o["name"], CountTraining = (int)o["countTraining"] }; object[] weightData = (object[])o["weight"]; res.Weight = new double[sizex, sizey]; int index = 0; for (int n = 0; n < res.Weight.GetLength(0); n++) { for (int m = 0; m < res.Weight.GetLength(1); m++) { res.Weight[n, m] = double.Parse(weightData[index].ToString()); index++; } } return(res); }
public static int SetTraining(string trainingName, ref int[,] data) { Neiron neiron = neironArray.Find(v => v.Name.Equals(trainingName)); if (neiron == null) { neiron.Clear(trainingName, sizex, sizey); neiron = new Neiron(); neironArray.Add(neiron); } return(neiron.Training(ref data)); }
public static string insertNeiron(Neiron neir) {//Добавление в БД нового документа sqlconnection = new SqlConnection(Connection); try { sqlconnection.Open(); SqlCommand com = new SqlCommand("SELECT COUNT(*) FROM Neirons WHERE id>=0", sqlconnection); int count = (int)com.ExecuteScalar(); com.ExecuteNonQuery(); com = new SqlCommand( $"INSERT INTO Neirons VALUES({count + 1},{neir})", sqlconnection); com.ExecuteNonQuery(); } catch (Exception) { return("Возникла ошибка добавления!"); } finally { sqlconnection.Close(); } return("Данные занесены в таблицу!"); }
public static void InsertNeironToDB(Neiron neir) => DataBase.insertNeiron(neir);
public const int sizex = 60, sizey = 60;//Число входов (100) public static void AddNeiron(Neiron neir) => neironArray.Add(neir);