It's trainin' time.

This commit is contained in:
MarcEricMartel
2023-05-14 08:00:18 -04:00
parent 12d745d1b0
commit 2db47abee0
4 changed files with 21 additions and 5 deletions

View File

@@ -8,11 +8,15 @@ namespace JeuHoy_WPF_Natif.Model {
public GestionFichiersSorties(){}
public List<Squelette> ChargerCoordonnees(string fichier) {
StreamReader lecteur = new StreamReader(fichier);
List<Squelette> lstSql = new List<Squelette>();
string sLigne = "";
string[] sTabElements = null;
if (!File.Exists(fichier))
return lstSql;
StreamReader lecteur = new StreamReader(fichier);
if (!lecteur.EndOfStream) {
sLigne = lecteur.ReadLine();
int nbElements = Convert.ToInt32(sLigne);

View File

@@ -4,19 +4,25 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JeuHoy_WPF_Natif.Model;
namespace JeuHoy_WPF_Natif.Model {
public class GestionPerceptrons {
private Dictionary<string, Perceptron> _lstPerceptrons = new Dictionary<string, Perceptron>();
private Model.IGestionFichiers _gestionSortie = new GestionFichiersSorties();
private List<Squelette> _lstData = new List<Squelette>();
private IGestionFichiers _gestionSortie = new GestionFichiersSorties();
private List<Squelette> _lstData;
/// <summary>
/// Constructeur
/// </summary>
public GestionPerceptrons() {
_lstData = _gestionSortie.ChargerCoordonnees("train.txt");
for (char x = '0'; x <= '9'; ++x)
_lstPerceptrons.Add(x.ToString(), new Perceptron(x.ToString()));
foreach (Squelette sql in _lstData)
Entrainement(sql, sql.Reponse);
}
/// <summary>
@@ -44,6 +50,7 @@ namespace JeuHoy_WPF_Natif.Model {
if (reponse != "") {
coordo.Reponse = reponse;
_lstData.Add(coordo);
SauvegarderCoordonnees("train.txt");
}
if (_lstData is null)