00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBackPropagationLayerBase_h
00018 #define __itkBackPropagationLayerBase_h
00019
00020 #include "itkLayerBase.h"
00021 #include "itkObject.h"
00022 #include "itkMacro.h"
00023
00024 namespace itk
00025 {
00026 namespace Statistics
00027 {
00028 template<class TVector, class TOutput>
00029 class BackPropagationLayer : public LayerBase<TVector, TOutput>
00030 {
00031 public:
00032 typedef BackPropagationLayer Self;
00033 typedef LayerBase<TVector, TOutput> Superclass;
00034 typedef SmartPointer<Self> Pointer;
00035 typedef SmartPointer<const Self> ConstPointer;
00036
00038 itkTypeMacro(BackPropagationLayer, LayerBase);
00039 itkNewMacro(Self);
00041
00042 typedef typename Superclass::ValueType ValueType;
00043 typedef typename Superclass::ValuePointer ValuePointer;
00044 typedef typename Superclass::ValueConstPointer ValueConstPointer;
00045 typedef vnl_vector<ValueType> NodeVectorType;
00046 typedef typename Superclass::InternalVectorType InternalVectorType;
00047 typedef typename Superclass::OutputVectorType OutputVectorType;
00048
00049
00050 void SetNumberOfNodes(unsigned int);
00051 ValueType GetInputValue(unsigned int i) const;
00052 void SetInputValue(unsigned int i, ValueType value);
00053
00054 ValueType GetOutputValue(unsigned int) const;
00055 void SetOutputValue(unsigned int, ValueType);
00056
00057 ValuePointer GetOutputVector();
00058 void SetOutputVector(TVector value);
00059
00060 void ForwardPropagate();
00061 void ForwardPropagate(TVector);
00062
00063 void BackwardPropagate(InternalVectorType e);
00064 void BackwardPropagate();
00065
00066 void SetOutputErrorValues(TOutput);
00067 ValueType GetOutputErrorValue(unsigned int) const;
00068
00069 ValueType GetInputErrorValue(unsigned int) const;
00070 ValuePointer GetInputErrorVector();
00071 void SetInputErrorValue(ValueType, unsigned int);
00072
00073 ValueType Activation(ValueType);
00074 ValueType DActivation(ValueType);
00075
00077 itkSetMacro( Bias, ValueType );
00078 itkGetConstReferenceMacro( Bias, ValueType );
00080
00081 protected:
00082
00083 BackPropagationLayer();
00084 ~BackPropagationLayer();
00085
00087 virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00088
00089 private:
00090
00091 NodeVectorType m_NodeInputValues;
00092 NodeVectorType m_NodeOutputValues;
00093 NodeVectorType m_InputErrorValues;
00094 NodeVectorType m_OutputErrorValues;
00095 ValueType m_Bias;
00096 };
00097
00098 }
00099 }
00100
00101 #ifndef ITK_MANUAL_INSTANTIATION
00102 #include "itkBackPropagationLayer.txx"
00103 #endif
00104
00105 #endif
00106