Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOneHiddenLayerBackPropagationNeuralNetwork_h
00018 #define __itkOneHiddenLayerBackPropagationNeuralNetwork_h
00019
00020 #include "itkMultilayerNeuralNetworkBase.h"
00021 #include "itkBackPropagationLayer.h"
00022 #include "itkSigmoidTransferFunction.h"
00023 #include "itkLogSigmoidTransferFunction.h"
00024 #include "itkTanSigmoidTransferFunction.h"
00025 #include "itkHardLimitTransferFunction.h"
00026 #include "itkSignedHardLimitTransferFunction.h"
00027 #include "itkGaussianTransferFunction.h"
00028 #include "itkIdentityTransferFunction.h"
00029 #include "itkSumInputFunction.h"
00030
00031
00032
00033 namespace itk
00034 {
00035 namespace Statistics
00036 {
00037
00038 template<class TMeasurementVector, class TTargetVector>
00039 class OneHiddenLayerBackPropagationNeuralNetwork :
00040 public MultilayerNeuralNetworkBase<TMeasurementVector, TTargetVector, BackPropagationLayer<TMeasurementVector, TTargetVector> >
00041 {
00042 public:
00043 typedef OneHiddenLayerBackPropagationNeuralNetwork Self;
00044 typedef MultilayerNeuralNetworkBase<TMeasurementVector, TTargetVector, BackPropagationLayer<TMeasurementVector, TTargetVector> >
00045 Superclass;
00046 typedef SmartPointer<Self> Pointer;
00047 typedef SmartPointer<const Self> ConstPointer;
00048
00049 typedef typename Superclass::ValueType ValueType;
00050 typedef typename Superclass::MeasurementVectorType MeasurementVectorType;
00051 typedef typename Superclass::TargetVectorType TargetVectorType;
00052 typedef typename Superclass::NetworkOutputType NetworkOutputType;
00053
00054 typedef typename Superclass::LayerInterfaceType LayerInterfaceType;
00055 typedef typename Superclass::LearningLayerType LearningLayerType;
00056
00057 typedef typename Superclass::WeightVectorType WeightVectorType;
00058 typedef typename Superclass::LayerVectorType LayerVectorType;
00059
00060 typedef typename Superclass::TransferFunctionInterfaceType
00061 TransferFunctionInterfaceType;
00062 typedef typename Superclass::InputFunctionInterfaceType
00063 InputFunctionInterfaceType;
00064
00065
00066 itkTypeMacro(OneHiddenLayerBackPropagationNeuralNetwork,
00067 MultilayerNeuralNetworkBase);
00068 itkNewMacro(Self);
00069
00070
00071
00072 void Initialize();
00073
00074 itkSetMacro(NumOfInputNodes, unsigned int);
00075 itkGetConstReferenceMacro(NumOfInputNodes, unsigned int);
00076
00077 itkSetMacro(NumOfFirstHiddenNodes, unsigned int);
00078 itkGetConstReferenceMacro(NumOfFirstHiddenNodes, unsigned int);
00079
00080 itkSetMacro(NumOfOutputNodes, unsigned int);
00081 itkGetConstReferenceMacro(NumOfOutputNodes, unsigned int);
00082
00083 itkSetMacro(FirstHiddenLayerBias, ValueType);
00084 itkGetConstReferenceMacro(FirstHiddenLayerBias, ValueType);
00085
00086
00087 #ifdef __USE_OLD_INTERFACE
00088
00089 inline void SetNumOfHiddenNodes(const unsigned int & x) { SetNumOfFirstHiddenNodes(x); }
00090 inline unsigned int GetNumOfHiddenNodes(void) const { return GetNumOfFirstHiddenNodes(); }
00091 inline void SetHiddenLayerBias(const ValueType & bias) { SetFirstHiddenLayerBias(bias); }
00092 ValueType GetHiddenLayerBias(void) const { return GetFirstHiddenLayerBias();}
00093 #endif
00094 itkSetMacro(OutputLayerBias, ValueType);
00095 itkGetConstReferenceMacro(OutputLayerBias, ValueType);
00096
00097 virtual NetworkOutputType GenerateOutput(TMeasurementVector samplevector);
00098
00099 void SetInputFunction(InputFunctionInterfaceType* f);
00100 void SetInputTransferFunction(TransferFunctionInterfaceType* f);
00101 #ifdef __USE_OLD_INTERFACE
00102
00103 inline void SetHiddenTransferFunction(TransferFunctionInterfaceType* f) { SetFirstHiddenTransferFunction (f); }
00104 #endif
00105 void SetFirstHiddenTransferFunction(TransferFunctionInterfaceType* f);
00106 void SetOutputTransferFunction(TransferFunctionInterfaceType* f);
00107 protected:
00108
00109 OneHiddenLayerBackPropagationNeuralNetwork();
00110 virtual ~OneHiddenLayerBackPropagationNeuralNetwork(){};
00111
00113 virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00114
00115 private:
00116
00117 unsigned int m_NumOfInputNodes;
00118 unsigned int m_NumOfFirstHiddenNodes;
00119 unsigned int m_NumOfOutputNodes;
00120
00121 ValueType m_FirstHiddenLayerBias;
00122 ValueType m_OutputLayerBias;
00123
00124 typename InputFunctionInterfaceType::Pointer m_InputFunction;
00125 typename TransferFunctionInterfaceType::Pointer m_InputTransferFunction;
00126 typename TransferFunctionInterfaceType::Pointer m_FirstHiddenTransferFunction;
00127 typename TransferFunctionInterfaceType::Pointer m_OutputTransferFunction;
00128 };
00129
00130 }
00131 }
00132
00133 #ifndef ITK_MANUAL_INSTANTIATION
00134 #include "itkOneHiddenLayerBackPropagationNeuralNetwork.txx"
00135 #endif
00136
00137 #endif
00138