Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Backpropagation Artificial Neural Network in C++

, 20 May 2008
This article demonstrates a backpropagation artificial neural network console application with validation and test sets for performance estimation using uneven distribution metrics.
ann_demo.zip
bin
ann1Dn.exe
dat
red.dat
red.hea
iris.nn
setosa_versi.dat
virgi.dat
void
ann_src.zip
src
Lib
LibNN


#include "stdAfx.h"
#include "neuron.h"



/*
                                                    ANN neuron link
                                                                                                                              */
//////////////////////////////////////////////////constructor/destructor////////////////////////////////////////////////////////
ANLink::ANLink(ANeuron *pinn, ANeuron *poutn, float in, float w, float add) : dwprv(0.0f)
{
        pinput_neuron = pinn;           //this neuron
        poutput_neuron  = poutn;        //out neuron

        ival = in;	                //input val
        this->w = w;                    //weight

        iadd = add;
}
ANLink::~ANLink()
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////








/*
                                                     ANN neuron
                                                                                                                              */
//////////////////////////////////////////////////constructor/destructor////////////////////////////////////////////////////////
ANeuron::ANeuron(): oval(0), delta(0), function(LINEAR)
{
}
ANeuron::~ANeuron()
{
        for (int i = 0; i < get_input_links_number(); i++)   //delete input links
                delete inputs[i];
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////add input link//////////////////////////////////////////////////
void ANeuron::add_bias()
{        
        inputs.push_back(new ANLink(this));
}
void ANeuron::add_input(ANeuron *poutn)       //add input link
{
        //poutn - N from previous layer
        ANLink *plnk = new ANLink(this, poutn); 
        inputs.push_back(plnk);
        if (poutn)                 
                poutn->outputs.push_back(plnk);        
}
///////////////////////////////////////////////////////////////////////////////////////////////////

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Chesnokov Yuriy
Engineer
Russian Federation Russian Federation
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 20 May 2008
Article Copyright 2007 by Chesnokov Yuriy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid