It's trainin' time.
This commit is contained in:
@@ -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);
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user