MainProgram.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using NeuralNetworkPCL;
  2. using System;
  3. using System.IO;
  4. using System.Linq;
  5. namespace NeuralNetworkProgram
  6. {
  7. class MainProgram : IHM
  8. {
  9. static void Main(string[] args)
  10. {
  11. MainProgram prog = new MainProgram();
  12. prog.Run();
  13. }
  14. private void Run()
  15. {
  16. // Problème du OU Exclusif (XOR)
  17. /*String[] content = ReadFile("xor.txt", true);
  18. NeuralSystem system = new NeuralSystem(2, 2, 1, content, 1.0, this);*/
  19. // Problème Abalone
  20. String[] content = ReadFile("abalone_norm.txt", false); // Le fichier est ajouté au projet comme contenu, et avec la propriété "copier si plus récent"
  21. NeuralSystem system = new NeuralSystem(10, 4, 1, content, 0.8, this);
  22. system.LearningRate(0.1);
  23. system.Run();
  24. while (true) ;
  25. }
  26. private String[] ReadFile(String _filename, bool _removeFirstLine)
  27. {
  28. String[] content = File.ReadAllLines(@_filename);
  29. if (_removeFirstLine)
  30. {
  31. content = content.Skip(1).ToArray();
  32. }
  33. return content;
  34. }
  35. public void PrintMsg(string _msg)
  36. {
  37. Console.Out.WriteLine(_msg);
  38. }
  39. }
  40. }