Discussion:
cant set activation steepness
Anatoly Yakovenko
2008-03-14 23:29:37 UTC
Permalink
i have a simple xor example, and I am trying to play around with
setting various options in fann, like the activation function
steepness for individual neurons, but i keep getting an error:

setting errorlog
FANN Error 17: Index 1 is out of bound.

here is my source:

#include "fann.h"

float xor() {
int ii,jj;
struct fann* nn = 0;
fann_type input[2];
fann_type output[1];

nn = fann_create_standard(3, 2, 2, 1);
fann_randomize_weights(nn, -0.1, 0.1);
fann_set_activation_steepness(nn, 0.5, 1, 1);
for(ii = 0; ii < 100000; ++ii) {
int aa,bb;
aa = ii % 2;
bb = (ii >> 1) % 2;
input[0] = aa;
input[1] = bb;
output[0] = aa ^ bb;
fann_train(nn, input, output);
}
for(ii = 0; ii < 4; ++ii) {
fann_type* out = 0;
input[0] = ii % 2;
input[1] = (ii >> 1) % 2;
out = fann_run(nn, input);
printf("%f ^ %f = %f\n", input[0], input[1], out[0]);
}
return fann_get_MSE(nn);
}

int main(int argc, char* argv[]) {
float xor_mse = xor();
printf("xor_mse: %f\n", xor_mse);
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Loading...