我在FANN中做双精度错误吗?

时间:2015-10-24 17:50:07

标签: neural-network fann

我正在尝试使用FANN,我想要函数逼近。我不知道我的数据和输出之间是否存在相关性,所以我不知道这个输出是否意味着没有相关性,或者我是否做错了。

这是我的培训计划,我链接-ldoublefann

#include "fann.h"

int main()
{
        const float connection_rate = 1;
        const float learning_rate = 0.7;
        const unsigned int num_input = 14;
        const unsigned int num_output = 2;
        const unsigned int num_layers = 3;
        const unsigned int num_neurons_hidden = 4;
        const float desired_error = 0.0001;
        const unsigned int max_iterations = 20000;
        const unsigned int iterations_between_reports = 1000;

        struct fann *ann = fann_create_standard (num_layers,
                num_input, num_neurons_hidden, num_output);

        fann_train_on_file(ann, "t120.train", max_iterations,
                iterations_between_reports, desired_error);

        fann_save(ann, "t120.net");

        fann_destroy(ann);

        return 0;
}

我的Makefile

CFLAGS=-ldoublefann

all: train
train: train.c

输出如下:

Max epochs    20000. Desired error: 0.0001000000.
Epochs            1. Current error: 1426.2332763672. Bit fail 568.
Epochs         1000. Current error: 1403.6292724609. Bit fail 569.
Epochs         2000. Current error: 1403.6292724609. Bit fail 569.
Epochs         3000. Current error: 1403.6292724609. Bit fail 569.
Epochs         4000. Current error: 1403.6292724609. Bit fail 569.
Epochs         5000. Current error: 1403.6292724609. Bit fail 569.

我正在看这个,它取得了一些初步进展,然后停止了冷。我不知道什么位失败意味着可能是我的问题,它可能认为我正在做二进制数据而不是双精度浮点。

这是我的数据:

My Data was too large to add to the post

我的数据包括大约285行,14个输入和2个输出。

我是否正确地这样做并且它没有相关性?或者我做错了什么?

1 个答案:

答案 0 :(得分:0)

您需要:

  1. #include "fann.h"并链接-lfann
  2. #include "doublefann.h"并链接-ldoublefann
  3. 请参阅此discussion和此question,其中有人遇到类似问题。