00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkRBFNetwork_h
00018 #define __itkRBFNetwork_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 #include "itkSymmetricSigmoidTransferFunction.h"
00032 #include "itkTanHTransferFunction.h"
00033 #include "itkEuclideanDistance.h"
00034 #include "itkRBFLayer.h"
00035
00036 namespace itk
00037 {
00038 namespace Statistics
00039 {
00040
00041 template<class TMeasurementVector, class TTargetVector>
00042 class RBFNetwork :
00043 public MultilayerNeuralNetworkBase<TMeasurementVector, TTargetVector, BackPropagationLayer<TMeasurementVector, TTargetVector> >
00044 {
00045 public:
00046 typedef RBFNetwork Self;
00047 typedef MultilayerNeuralNetworkBase<TMeasurementVector, TTargetVector , BackPropagationLayer<TMeasurementVector, TTargetVector> > Superclass;
00048 typedef SmartPointer<Self> Pointer;
00049 typedef SmartPointer<const Self> ConstPointer;
00050
00051 typedef typename Superclass::ValueType ValueType;
00052 typedef typename Superclass::MeasurementVectorType MeasurementVectorType;
00053 typedef typename Superclass::TargetVectorType TargetVectorType;
00054 typedef typename Superclass::NetworkOutputType NetworkOutputType;
00055
00056 typedef typename Superclass::LayerInterfaceType LayerInterfaceType;
00057 typedef typename Superclass::LearningLayerType LearningLayerType;
00058
00059 typedef typename Superclass::WeightVectorType WeightVectorType;
00060 typedef typename Superclass::LayerVectorType LayerVectorType;
00061
00062 typedef typename Superclass::TransferFunctionInterfaceType TransferFunctionInterfaceType;
00063 typedef typename Superclass::InputFunctionInterfaceType InputFunctionInterfaceType;
00064
00065
00066 typedef Array<ValueType> ArrayType;
00067 typedef EuclideanDistance<ArrayType> DistanceMetricType;
00068 typedef RadialBasisFunctionBase<ValueType> RBFTransferFunctionType;
00069 typedef RBFLayer<TMeasurementVector, TTargetVector> HiddenLayerType;
00070
00071 itkSetMacro(Classes, unsigned int);
00072 itkGetConstReferenceMacro(Classes, unsigned int);
00073 void SetCenter(TMeasurementVector c);
00074 void SetRadius(ValueType r);
00075 void SetDistanceMetric(DistanceMetricType* f);
00076 void InitializeWeights();
00077
00078
00079 itkTypeMacro(RBFNetwork,
00080 MultilayerNeuralNetworkBase);
00081 itkNewMacro(Self) ;
00082
00083
00084
00085 void Initialize();
00086
00087 itkSetMacro(NumOfInputNodes, unsigned int);
00088 itkGetConstReferenceMacro(NumOfInputNodes, unsigned int);
00089
00090 itkSetMacro(NumOfFirstHiddenNodes, unsigned int);
00091 itkGetConstReferenceMacro(NumOfFirstHiddenNodes, unsigned int);
00092
00093 itkSetMacro(NumOfOutputNodes, unsigned int);
00094 itkGetConstReferenceMacro(NumOfOutputNodes, unsigned int);
00095
00096 itkSetMacro(FirstHiddenLayerBias, ValueType);
00097 itkGetConstReferenceMacro(FirstHiddenLayerBias, ValueType);
00098
00099
00100 #ifdef __USE_OLD_INTERFACE
00101
00102 inline void SetNumOfHiddenNodes(const unsigned int & x) { SetNumOfFirstHiddenNodes(x); }
00103 inline unsigned int GetNumOfHiddenNodes(void) const { return GetNumOfFirstHiddenNodes(); }
00104 inline void SetHiddenLayerBias(const ValueType & bias) { SetFirstHiddenLayerBias(bias); }
00105 ValueType GetHiddenLayerBias(void) const { return GetFirstHiddenLayerBias();};
00106 #endif
00107 itkSetMacro(OutputLayerBias, ValueType);
00108 itkGetConstReferenceMacro(OutputLayerBias, ValueType);
00109
00110 virtual NetworkOutputType GenerateOutput(TMeasurementVector samplevector);
00111
00112 void SetInputFunction(InputFunctionInterfaceType* f);
00113 void SetInputTransferFunction(TransferFunctionInterfaceType* f);
00114 #ifdef __USE_OLD_INTERFACE
00115
00116 inline void SetHiddenTransferFunction(TransferFunctionInterfaceType* f) { SetFirstHiddenTransferFunction (f); };
00117 #endif
00118 void SetFirstHiddenTransferFunction(TransferFunctionInterfaceType* f);
00119 void SetOutputTransferFunction(TransferFunctionInterfaceType* f);
00120 protected:
00121
00122 RBFNetwork();
00123 virtual ~RBFNetwork(){};
00124
00126 virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00127
00128 private:
00129
00130 typename DistanceMetricType::Pointer m_DistanceMetric;
00131 std::vector<TMeasurementVector> m_Centers;
00132 std::vector<double> m_Radii;
00133 unsigned int m_Classes;
00134
00135 unsigned int m_NumOfInputNodes;
00136 unsigned int m_NumOfFirstHiddenNodes;
00137 unsigned int m_NumOfOutputNodes;
00138
00139 ValueType m_FirstHiddenLayerBias;
00140 ValueType m_OutputLayerBias;
00141
00142 typename InputFunctionInterfaceType::Pointer m_InputFunction;
00143 typename TransferFunctionInterfaceType::Pointer m_InputTransferFunction;
00144 typename RBFTransferFunctionType::Pointer m_FirstHiddenTransferFunction;
00145 typename TransferFunctionInterfaceType::Pointer m_OutputTransferFunction;
00146 };
00147
00148 }
00149 }
00150
00151 #ifndef ITK_MANUAL_INSTANTIATION
00152 #include "itkRBFNetwork.txx"
00153 #endif
00154
00155 #endif
00156