aggiornato classificatore singolo per mnist
This commit is contained in:
@@ -77,20 +77,20 @@ void main() {
|
||||
|
||||
int corrette = 0;
|
||||
|
||||
for(int indice_set = 0; indice_set < set.size; indice_set++) {
|
||||
|
||||
printf("\timmagine: %d\n", indice_set);
|
||||
for(int indice_set = 0; indice_set < set.size -1; indice_set++) {
|
||||
|
||||
double **sigmoidi = (double **)malloc(sizeof(double*) * NUM_LAYERS);
|
||||
|
||||
sigmoidi[0] = (double*)malloc(sizeof(double) * PERCETTRONI_LAYER_0);
|
||||
sigmoidi[0] = funzioni_attivazione_layer_byte(rete_neurale.layers[0], set.istanze[indice_set].immagine);
|
||||
|
||||
|
||||
for(int j = 1; j < NUM_LAYERS; j++) {
|
||||
sigmoidi[j] = (double*)malloc(sizeof(double) * rete_neurale.layers[j].size);
|
||||
sigmoidi[j] = funzioni_attivazione_layer_double(rete_neurale.layers[j], sigmoidi[j-1]);
|
||||
}
|
||||
|
||||
//printf("\timmagine: %d post sigmoidi\n", indice_set);
|
||||
|
||||
byte output_corretto = get_out_corretto(set.istanze[indice_set].categoria);
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ void main() {
|
||||
gradienti[indice_layer] = (double*)malloc(sizeof(double) * rete_neurale.layers[indice_layer].size);
|
||||
}
|
||||
|
||||
gradienti[NUM_LAYERS-1][0] = output_corretto - sigmoidi[NUM_LAYERS-1][0];
|
||||
gradienti[NUM_LAYERS-1][0] = - (output_corretto - sigmoidi[NUM_LAYERS-1][0]);
|
||||
|
||||
correggi_layer_interni(&rete_neurale, gradienti, sigmoidi);
|
||||
correggi_layer_input(&rete_neurale.layers[0], gradienti, sigmoidi, set.istanze[indice_set].immagine, NUM_LAYERS);
|
||||
@@ -113,7 +113,7 @@ void main() {
|
||||
corrette++;
|
||||
}
|
||||
|
||||
printf("\timmagine: %d post calcoli, indovinate: %d\n", indice_set, corrette);
|
||||
//printf("\timmagine: %d post correzioni\n", indice_set);
|
||||
}
|
||||
|
||||
printf("\tRisposte corrette: %d\n", corrette);
|
||||
|
||||
Reference in New Issue
Block a user