00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMultilayerNeuralNetworkBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/08/02 19:17:37 $ 00007 Version: $Revision: 1.1 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __MultiLayerNeuralNetworkBase_h 00018 #define __MultiLayerNeuralNetworkBase_h 00019 00020 #include "itkNeuralNetworkObject.h" 00021 #include "itkErrorBackPropagationLearningFunctionBase.h" 00022 #include "itkErrorBackPropagationLearningWithMomentum.h" 00023 #include "itkQuickPropLearningRule.h" 00024 00025 namespace itk 00026 { 00027 namespace Statistics 00028 { 00029 00030 template<class TVector, class TOutput> 00031 class MultilayerNeuralNetworkBase : public NeuralNetworkObject<TVector, TOutput> 00032 { 00033 public: 00034 00035 typedef MultilayerNeuralNetworkBase Self; 00036 typedef NeuralNetworkObject<TVector, TOutput> Superclass; 00037 typedef SmartPointer<Self> Pointer; 00038 typedef SmartPointer<const Self> ConstPointer; 00039 itkTypeMacro(MultilayerNeuralNetworkBase, NeuralNetworkObject); 00040 00041 typedef typename Superclass::ValueType ValueType; 00042 00043 typedef typename Superclass::LayerType LayerType; 00044 typedef typename Superclass::WeightSetType WeightSetType; 00045 typedef typename Superclass::WeightSetPointer WeightSetPointer; 00046 typedef typename Superclass::LayerPointer LayerPointer; 00047 typedef typename Superclass::LearningFunctionType LearningFunctionType; 00048 typedef typename Superclass::LearningFunctionPointer LearningFunctionPointer; 00049 00050 typedef std::vector<WeightSetPointer> WeightVectorType; 00051 typedef std::vector<LayerPointer> LayerVectorType; 00052 00053 itkSetMacro(NumOfLayers, int); 00054 itkGetConstReferenceMacro(NumOfLayers, int); 00055 00056 void AddLayer(LayerType*); 00057 00058 void AddWeightSet(WeightSetType*); 00059 00060 void SetLearningFunction(LearningFunctionType* f); 00061 00062 virtual ValueType* GenerateOutput(TVector samplevector); 00063 00064 virtual void BackwardPropagate(TOutput errors); 00065 00066 virtual void UpdateWeights(ValueType); 00067 00068 void SetLearningRule(LearningFunctionType*); 00069 00070 void SetLearningRate(ValueType learningrate); 00071 00072 void InitializeWeights(); 00073 00074 protected: 00075 MultilayerNeuralNetworkBase(); 00076 ~MultilayerNeuralNetworkBase(); 00077 00078 LayerVectorType m_Layers; 00079 WeightVectorType m_Weights; 00080 LearningFunctionPointer m_LearningFunction; 00081 ValueType m_LearningRate; 00082 int m_NumOfLayers; 00083 00085 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00086 }; 00087 00088 } // end namespace Statistics 00089 } // end namespace itk 00090 00091 #ifndef ITK_MANUAL_INSTANTIATION 00092 #include "itkMultilayerNeuralNetworkBase.txx" 00093 #endif 00094 00095 #endif
1.4.1 written by Dimitri van Heesch,
© 1997-2000