static void Main(string[] args) { string selection = null; while (selection != "1" && selection != "2") { Console.Clear(); Console.WriteLine("1) Cartographie"); Console.WriteLine("2) Fleurs d'iris"); Console.WriteLine("Quel jeu de test?"); selection = Console.ReadLine(); selection = selection.Trim(); } #region Création Console.Clear(); Console.WriteLine("Création du réseau"); int[] topologie; if (selection == "1") { topologie = new int[] { 2, 2, 1 }; } else { topologie = new int[] { 4, 7, 3 }; } DeepNetwork deepNetwork = new DeepNetwork(1, topologie); Console.WriteLine("Nb de couches: {0}", deepNetwork.Couches.Length); Console.WriteLine("Topologie du réseau: {0}", string.Join("x", topologie)); int nbPoids = 0; for (int i = 1; i < topologie.Length; i++) { nbPoids += topologie[i] * topologie[i - 1]; } Console.WriteLine("Nombre de poids: {0}", nbPoids); Console.WriteLine("Nombre de biais/neurones: {0}", topologie[1] + topologie[topologie.Length - 1]); Console.WriteLine("---------------------------------------------"); Console.WriteLine(); #endregion Helper.PoidsAleatoires(deepNetwork, false); // vitesse d'apprentissage double pas = 0.5; double maxErreur = 0.03; int maxIteration = 5000; if (selection == "1") { Cartographie(); } else { // iris pas = 0.05; maxErreur = 0.001; maxIteration = 500; Iris(); } deepNetwork.Calculer(entrainement[0]); Helper.AfficherReseau(deepNetwork); // entraînement Console.WriteLine("Entraînement du réseau sur {0} tests et {1} itérations max", entrainement.Length, maxIteration); Console.WriteLine("Pas: {0}", pas); double erreur = deepNetwork.Entrainer(entrainement, cibleEntrainement, maxIteration, pas, maxErreur); Console.WriteLine("Erreur en fin d'apprentissage: {0}", erreur); Helper.AfficherReseau(deepNetwork); // jeu de test Couche coucheSortie = deepNetwork.Couches[2]; for (int i = 0; i < tests.Length; i++) { deepNetwork.Calculer(tests[i]); Console.WriteLine("Test {0}", i); Helper.AfficherVecteur(tests[i], "Entrées:"); Helper.AfficherSorties(coucheSortie.Neurones, "Calculé: "); Helper.AfficherVecteur(cibleTest[i], "Cible:"); Console.WriteLine(); } Console.WriteLine("Terminé"); Console.ReadLine(); }