Click here to Skip to main content
13,295,987 members (49,857 online)
Click here to Skip to main content


112 bookmarked
Posted 27 Mar 2006

Back-propagation Neural Net

, 28 Mar 2006
A C++ class implementing a back-propagation algorithm neural net, that supports any number of layers/neurons.
//	Fully connected multilayered feed		//
//	forward	artificial neural network using	//
//	Backpropogation	algorithm for training.	//

#ifndef backprop_h
#define backprop_h


class CBackProp{

//	output of each neuron
	double **out;

//	delta error value for each neuron
	double **delta;

//	vector of weights for each neuron
	double ***weight;

//	no of layers in net
//	including input layer
	int numl;

//	vector of numl elements for size 
//	of each layer
	int *lsize;

//	learning rate
	double beta;

//	momentum parameter
	double alpha;

//	storage for weight-change made
//	in previous epoch
	double ***prevDwt;

//	squashing function
	double sigmoid(double in);



//	initializes and allocates memory
	CBackProp(int nl,int *sz,double b,double a);

//	backpropogates error for one set of input
	void bpgt(double *in,double *tgt);

//	feed forwards activations for one set of inputs
	void ffwd(double *in);

//	returns mean square error of the net
	double mse(double *tgt) const;	
//	returns i'th output of the net
	double Out(int i) const;


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.


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


About the Author

Tejpal Singh Chhabra
Software Developer
Australia Australia
A technology enthusiast with interest in all aspects of software development. I code in C, C++, Java and Go mostly on Unix/Linux.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 28 Mar 2006
Article Copyright 2006 by Tejpal Singh Chhabra
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid