mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-24 07:36:24 +01:00
Add error function
This commit is contained in:
parent
63c2544b45
commit
92455a5335
@ -223,4 +223,23 @@ void initialisation_du_reseau_neuronal(Reseau* reseau) {
|
||||
neurone->activation = borne_inferieure + ((double)rand())/((double)RAND_MAX)*(borne_superieure - borne_inferieure);
|
||||
neurone->biais = borne_inferieure + ((double)rand())/((double)RAND_MAX)*(borne_superieure - borne_inferieure); // On initialise le biais aléatoirement
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float erreur_sortie(Reseau* reseau, int numero_voulu){
|
||||
/* Renvoie l'erreur du réseau neuronal pour une sortie */
|
||||
float erreur = 0;
|
||||
Couche* derniere_couche = reseau->couches[reseau->nb_couches-1];
|
||||
|
||||
for (int i=0; i < reseau->nb_couches-1; i++) {
|
||||
if (i==numero_voulu) {
|
||||
erreur += (1-derniere_couche->neurones[i]->z)*(1-derniere_couche->neurones[i]->z);
|
||||
}
|
||||
else {
|
||||
erreur += derniere_couche->neurones[i]->z*derniere_couche->neurones[i]->z;
|
||||
}
|
||||
}
|
||||
return erreur;
|
||||
}
|
Loading…
Reference in New Issue
Block a user