using namespace st...">

FANN - I get the wrong results (about 0) with just a task

#include "doublefann.h"
#include "fann_cpp.h"
#include <iostream>

using namespace std;

int main() {
    FANN::neural_net* sth = new FANN::neural_net();
    sth->create_standard(3, 1, 2, 1);
    double inputs[1] = {0.000005};
    double outputs[1] = {0.8};
    double *wynik;
    for(int i = 0; i < 1000; i++) {
        sth->train(inputs, outputs);
        wynik = sth->run(inputs);
        cout << wynik[0] << endl;
    }
}

I have: 5.20981e-315, 5.201e-315, 5.19371e-315, 5.18769e-315, 5.18269e-315, 5.1786e-315.

What am I doing wrong?

0
source share
1 answer

Ok I understood. At http://leenissen.dk/fann/forum/viewtopic.php?t=354 is a solution. If you include "doublefann.h", you must specify "-ldoublefann" instead of "-lfann" in the compiler options.

+1
source

Source: https://habr.com/ru/post/1538287/


All Articles