GradientDescentCalibrator.h

00001 /*
00002  *====================================================================
00003  * HISTORY:
00004  * -------
00005  * $Log: GradientDescentCalibrator.h,v $
00006  * Revision 1.1  2008/08/23 14:28:48  samit_ahlawat
00007  * Feed forward neural network library
00008  *
00009  * 
00010  * ID:
00011  * --
00012  * static const char *CvsId = "@(#)$Id: GradientDescentCalibrator.h,v 1.1 2008/08/23 14:28:48 samit_ahlawat Exp $";
00013  *====================================================================
00014  */
00015 
00016 #ifndef _GRADIENT_DESCENT_CALIBRATOR_H_
00017 #define _GRADIENT_DESCENT_CALIBRATOR_H_
00018 
00019 
00020 #include <stdexcept>
00021 #include <vector>
00022 
00023 class NeuralNetwork;
00024 class TestData;
00025 
00031 class GradientDescentCalibrator
00032 {
00033     private:
00034         NeuralNetwork* pNetwork;
00035         TestData* pAllData;
00037         double dEeta;
00039         double* pDelta;
00040 
00044         double* pOutputArr;
00045 
00049         double* pAllNeuronsInput;
00050 
00052         int iMaxLevelNeurons;
00053 
00058         int* pAnteriorNeurons;
00059 
00064         double* pWeightAnteriorNeurons;
00065 
00068         int* pNumAnteriorNeurons;
00069 
00070         GradientDescentCalibrator(const GradientDescentCalibrator& calib) { throw new std::invalid_argument("copy prohibited"); }
00071         GradientDescentCalibrator& operator= (const GradientDescentCalibrator& calib) { throw new std::invalid_argument("copy prohibited"); }
00072 
00073         void InitializeWeights();
00074         double ComputeResidual();
00075         void BackpropagateCorrections();
00076         void FindAnteriorNeurons();
00077         void Destroy();
00078 
00079     public:
00080         GradientDescentCalibrator(NeuralNetwork* network, TestData* data, double eeta) :
00081             pNetwork(network), pAllData(data), dEeta(eeta), pDelta(0), 
00082             pOutputArr(0), pAllNeuronsInput(0), pAnteriorNeurons(0), 
00083             pWeightAnteriorNeurons(0), pNumAnteriorNeurons(0) {};
00084 
00086         bool Calibrate(int maxIter, double minResidual, double& finalResidual);
00087 
00088         ~GradientDescentCalibrator() { Destroy(); }
00089 };
00090 
00091 #endif // _GRADIENT_DESCENT_CALIBRATOR_H_
00092 

Generated on Sun Aug 24 17:33:41 2008 by  doxygen 1.4.6