Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7629063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:44:23+00:00 2026-05-31T05:44:23+00:00

I’ve been experimenting with the FANN library, which seems to be a great library

  • 0

I’ve been experimenting with the FANN library, which seems to be a great library for neural network, and I’m having some issue on how to use it.

So what I’m trying to do here is training a neural network, for the sake of messing with the library, giving it an input and expecting an output.

FANN::neural_net nn;
const float desired_error = 0.00001;
const unsigned int max_epochs = 500000;
const unsigned int epochs_between_reports = 1000;
const unsigned int layers_count = 3;
const unsigned int layers[layers_count] = {7, 5, 1};
nn.create_standard_array(layers_count, layers);
nn.train_on_file(TRAINING_DATA, max_epochs, epochs_between_reports, desired_error);

Here are the first lines of my training data file (TRAINING_DATA) :

16969 7 1
0.0812069 0.0812069 0.381578 0.0812069 5.8931e-05 0.0843302 0.606695 
1
0.429961 0.0509753 0.381578 0.0266957 0.000117862 0.00707172 0.0221581 
1
0.0983558 0.486888 0.381578 0.000117862 0.0266957 0.00701279 0.0539808 
1
0.0983558 0.486888 0.598562 0.0161471 0.0161471 0.000471448 0.00135541 
1

The complete dataset can be found here

Using a sample data from the training data file, I should get the output matching it, right? However, if I do the following, I get 0 as output…

fann_type i[7], *o;
i[0] = 0.429961; i[1] = 0.0509753; i[2] = 0.381578; i[3] = 0.0266957; i[4] = 0.000117862; i[5] = 0.00707172; i[6] = 0.0221581;
o = nn.run(i);
std::cout << "output (run) is " << o[0] << std::endl;

Can someone actually explain me what is going on here?

I use the 2.2.0 version of fann.

Thank you

Edit : It seems that the 2.1.0 beta version give the expected results, but not the 2.2.0 version.

Edit 2 : It was actually a bug in the version I was using.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:44:25+00:00Added an answer on May 31, 2026 at 5:44 am

    I tried to reproduce your error but I could not. Here is my program:

    #include<iostream>
    using namespace std;
    #include <fann.h>
    #include <fann_cpp.h>
    #include <floatfann.h>
    int main()
    {
      FANN::neural_net nn;
      const float desired_error = 0.00001;
      const unsigned int max_epochs = 500000;
      const unsigned int epochs_between_reports = 1000;
      const unsigned int layers_count = 3;
      const unsigned int layers[layers_count] = {7, 5, 1};
      nn.create_standard_array(layers_count, layers);
      nn.train_on_file("test.train", max_epochs, epochs_between_reports, desired_error);
    
      fann_type i[7];
      i[0] = 0.429961; i[1] = 0.0509753; i[2] = 0.381578; i[3] = 0.0266957; i[4] = 0.000117862; i[5] = 0.00707172; i[6] = 0.0221581;
      fann_type *o = nn.run(i);
      std::cout << "output (run) is " << o[0] << std::endl;
    
      return 0;
    }
    

    This is the output:

    Max epochs   500000. Desired error: 0.0000100000.
    Epochs            1. Current error: 0.2283857614. Bit fail 4.
    Epochs            7. Current error: 0.0000000000. Bit fail 0.
    output (run) is 1
    

    Maybe you could provide your full training set?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to select an H1 element which is the second-child in its group
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.