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

Tagged as

Back-propagation Neural Net

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


#ifndef backprop_h
#define backprop_h

#include<assert.h>
#include<iostream.h>
#include<stdio.h>
#include<math.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);

public:

	~CBackProp();

//	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;
};

#endif

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

Tejpal Singh Chhabra
Software Developer
India India
I have done Masters in Computer Application. I work with a software product development company, where I code in c, c++ and java, mostly on unix.
Follow on   LinkedIn

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