Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
$29

Personal License

1 application Binary restricted distribution
$49

Support Provided

1 application Binary restricted distribution 6 months support
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

  • Released: Jul 25, 2011
    Last Update: Jul 25, 2011
  • Language: C/C++
  • Category: Statistics

Artificial Neural Network Framework

Artificial Neural Network Framework
Developed by Samuel Hiard, Released Jul 25, 2011

An ANSI C framework for ANN

C/C++

Tags: ai , artificial , backpropagation , descent

This framework is designed for artificial neural network creation and use.

The used structure is multi-layer perceptrons (MLP) where each neuron computes either a sigmoid function or the hyperbolic tangent.

Each layer contains a bias neuron which always outputs the value "1"

The weight update is performed with the gradient descent backpropagation algorithm

Back to top

Instructions of use

First select the number of hidden layers, the number of neurons per layer and the function type (sigmoid or tanh).

Put your database into memory according to the main function example

Call the createNetworkStructure function, which will put the structure of the ANN into memory.

Train the network for a certain number of epochs using the trainNetwork function. You may also test the model at each epoch as depicted in the main function example.

For each prediction, call the forwardPass function

That's it!, you can now use a neural network !

Back to top

Background

A neural network with multi-layer perceptron is a graph structure where each node in an hidden layer is connected to every node in the following layer. But no connection exists between layers of a distance >= 2.

The network is trained using a backpropagation algorithm, here with the gradient descent. The concept is easy to understand : one forward pass is performed per object in the database. The output of the network is compared to what was expected, and the weights are updated to correct the output.

When should I use neural networks?

The use of ANN is recommended if :

  • A lot of examples can be obtained easily
  • The function you want to model is complex, but should exist
  • Precision on output is not that important

If one of these conditions is not fulfulled, you should consider using another machine learning method, otherwise, go for ANNs !

Back to top

Usage Example

#pragma argsused
int main(int argc, char* argv[])
{

int NbInput = 2;            //Number of input variables
int NbHidden = 2;           //Number of hidden layers
int NbNodes = 25;           //Number of nodes in each hidden layer
int NbOutput = 1;           //Number of output variables
int NbRuns = 500;           //Number of epochs
double LearningRate = 0.1;  //Learning rate (between 0 and 1)
int Type = 2;               //0 = sigmoide, 1 = identity (DON'T USE THIS), 2 = tanh

int DatabaseSize = 7;       //Number of objects in the database

NeuralNetwork nn;
double** TabOutput;
Elem* Database;
double* Outputs;
double* Inputs;

int i, j;


//Dynamic allocation
Database = (Elem*)malloc(DatabaseSize*sizeof(Elem));
for(i=0; i < DatabaseSize; i++)
{
    Database[i].Att = (double*)malloc(NbInput*sizeof(double));
    Database[i].GOAL = (double*)malloc(NbOutput*sizeof(double));
}

//Filling the database
Database[0].Att[0] = 0.1;
Database[0].Att[1] = 0.4;
Database[0].GOAL[0] = 0.25;
Database[1].Att[0] = 0.2;
Database[1].Att[1] = 1;
Database[1].GOAL[0] = 0.6;
Database[2].Att[0] = -0.3;
Database[2].Att[1] = 0.9;
Database[2].GOAL[0] = 0.3;
Database[3].Att[0] = 0.4;
Database[3].Att[1] = -0.4;
Database[3].GOAL[0] = 0.0;
Database[4].Att[0] = 0.9;
Database[4].Att[1] = 0.8;
Database[4].GOAL[0] = 0.85;
Database[5].Att[0] = 0.2;
Database[5].Att[1] = 0.7;
Database[5].GOAL[0] = 0.45;
Database[6].Att[0] = -0.1;
Database[6].Att[1] = 0.5;
Database[6].GOAL[0] = 0.2;

//Init the random seed
srand(time(NULL));

//Creating the network
nn = createNetworkStructure(NbInput, NbHidden, NbNodes, NbOutput, Type, LearningRate);

//Creating the array for output values
fprintf(stderr,"Creation of output array\n");
TabOutput = (double**)malloc((NbHidden)*sizeof(double*));
for(i = 0; i < NbHidden; i++)
{
    TabOutput[i] = (double*)malloc((NbNodes+1)*sizeof(double));
}

//Network training
for(i = 0; i < NbRuns; i++)
{
    trainNetwork(nn,TabOutput,1, Database, DatabaseSize);

    //Test
    Inputs = (double*)malloc((nn.NbInput+1)*sizeof(double));
    Inputs[0] = -0.3;
    Inputs[1] = 0.9;
    Inputs[2] = 1;
    Outputs = forwardPass(nn,TabOutput,Inputs);
    fprintf(stderr,"Average of 0.9 and -0.3 = %f (Expected : 0.3) \n",Outputs[0]);

    free(Outputs);
    Inputs[0] = 0.8;
    Inputs[1] = 0.9;
    Inputs[2] = 1;
    Outputs = forwardPass(nn,TabOutput,Inputs);
    fprintf(stderr,"Average of 0.8 and 0.9 = %f (Expected : 0.85) \n",Outputs[0]);

    free(Outputs);
    free(Inputs);

}
//Destruction of output array
fprintf(stderr,"Destruction of output array\n");
for(i = 0; i < NbHidden; i++)
    free(TabOutput[i]);
free(TabOutput);

//Destruction of the network
freeNetwork(nn);

//Destruction of the database
for(i = 0; i <  DatabaseSize; i++)
{
    free(Database[i].Att);
    free(Database[i].GOAL);
}
free(Database);

printf("Press  to quit...\n");
getchar();
return 0;
}

User Reviews

No reviews have been submitted yet.
Read all 2 comments »

Questions & Comments


Or enter your name and Email
  • mahesh 7 months ago
    I WANT TO DO WORK ON ANN OF MY THESIS OPTIMIZATION OF A SUGAR FACTORY BOILER,PLS SUGGEST HOW TO START MY MODELS FOR OUTPUT DATA AND OUTPUT DATA?
    • oluseunmi 7 months ago
      please do you have the ANN software; please do let me know if yes....i to am working on environmenta noise and i need the software for analysis....please you can assist me by sending it to my email : seunphysics@gmail.com, please
You must be logged-in to vote. Log-in to your account or register now.