FANN - I get incorrect results (near 0) at simply task [closed]

99封情书 提交于 2019-12-02 22:46:53

问题


#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've got: 5.20981e-315, 5.201e-315, 5.19371e-315, 5.18769e-315, 5.18269e-315, 5.1786e-315.

What I am doing wrong?


回答1:


Ok. I've got it. On http://leenissen.dk/fann/forum/viewtopic.php?t=354 is a solution. If you include "doublefann.h" you should link "-ldoublefann" instead "-lfann" in compiler options.



来源:https://stackoverflow.com/questions/9795468/fann-i-get-incorrect-results-near-0-at-simply-task

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!