TarzaNN
TarzaNN neural network simulator
|
00001 #ifndef CTSOMFeaturePlane_H_INCLUDED 00002 #define CTSOMFeaturePlane_H_INCLUDED 00003 00004 #include <qimage.h> 00005 00006 #include "nowarn.h" 00007 #include "common.h" 00008 #include <stdlib.h> 00009 00010 #include "OutputImage.h" 00011 #include "LearningFeaturePlane.h" 00012 #include "FilterBank.h" 00013 #include "PlaneInputWindowSet.h" 00014 #include "MatrixOfMatrix.h" 00015 00017 class CTSOMFeaturePlane : public LearningFeaturePlane { 00018 friend class GatingUnits; 00019 friend class FeaturePlaneFactory; 00020 public: 00021 ~CTSOMFeaturePlane(); 00022 void read(QDataStream* inStream, QProgressDialog* progress, int* index); 00023 00024 void save(QDataStream* outStream, QProgressDialog* progress, int* index); 00025 bool isLearning(); 00026 00027 static void compete(vector<FeaturePlaneAbstract*> _featurePlanes, Layer* theLayer, int step); 00028 static void competeOld(vector<FeaturePlaneAbstract*> _featurePlanes, Layer* theLayer, int step); 00029 FeaturePlaneInput* addFilter(Filter* f, FeaturePlaneAbstract*fp, int type, int fpOutputIndex, bool wta); 00030 void incWinCount(){ 00031 winCount++; 00032 } 00033 int getWinCount(){ 00034 return winCount; 00035 } 00036 00037 protected: 00038 00055 CTSOMFeaturePlane( Network* net, int l, QString* name, int w, int h, int angles, int speeds, int alpha, int speed, bool isWTA, bool visible, Neuron* neuron, NotifyStrategyAbstract* notify, bool learning); 00056 void step(); 00057 00058 float nonlinearity(Matrix* totalActivation, OutputImage* workOutput); 00059 void computeGatingUnits(); 00060 00061 private: 00062 static const char* FilterFileName; 00063 00065 vector<RandomFilter*> theInputFilters; 00066 void saveFilters(int step, int index); 00067 00069 int winCount; 00070 00071 void learn(); 00072 void learn(uint32_t x, uint32_t y); 00073 void updateWeights(RandomFilter* theFilter, Matrix* input, float alpha, uint32_t x, uint32_t y); 00074 00075 float alpha(); 00076 static float surround(int step); 00077 }; 00078 #endif //CTSOMFeaturePlane_H_INCLUDED