ref: c065dd9cc39be75c6ba33d2aa36111ee25689c87
parent: 79f48ee47c9d08563e0adfee90911df3f51c4f94
author: eli <eli@singularity>
date: Tue Dec 24 11:45:44 EST 2024
ann
--- a/ann.c
+++ b/ann.c
@@ -222,7 +222,7 @@
va_start(args, num_layers);
ret->n = num_layers;
- ret->rate = 0.25;
+ ret->rate = 0.7;
ret->layers = calloc(num_layers, sizeof(Layer*));
ret->weights = calloc(num_layers-1, sizeof(Weights*));
ret->deltas = calloc(num_layers-1, sizeof(Weights*));
@@ -251,7 +251,7 @@
int i;
ret->n = num_layers;
- ret->rate = 0.25;
+ ret->rate = 0.7;
ret->layers = calloc(num_layers, sizeof(Layer*));
ret->weights = calloc(num_layers-1, sizeof(Weights*));
ret->deltas = calloc(num_layers-1, sizeof(Weights*));
@@ -320,6 +320,12 @@
error[o] -= outputs[o];
error[o] = -error[o];
ret += pow(error[o], 2.0) * 0.5;
+ if (error[o] < -.9999999)
+ error[o] = -17.0;
+ else if (error[o] > .9999999)
+ error[o] = 17.0;
+ else
+ error[o] = log((1.0 + error[o]) / (1.0 - error[o]));
}
D = ann->deltas[ann->n-2];
weightsinitdoubles(D, error);