00001 #ifndef __IcaNet__ 00002 #define __IcaNet__ 00003 00028 #include "RealVector.hpp" 00029 00030 class IcaNet 00031 { 00032 private: 00033 00034 bool superGaussian; 00035 bool combined; 00036 00037 double learnRate; 00038 00039 double a; // a >= 1.0, a >> b avoids instabilities 00040 double b; // b > 0 00041 double c; // avoid w zero, c>a 00042 00043 RealVector* w; 00044 double wNorm2; 00045 RealVector* dw; 00046 00047 protected: 00048 00049 // gMin approximate sigmoids 00050 // tanh ~= a=1.0 and b=1/3 00051 virtual double g(double u){ return (a*u - b*u*u*u); } 00052 virtual double gMin(double u){ return (a*u - b*u*u*u); } 00053 virtual double gPlus(double u); 00054 00055 virtual void learn(RealVector* sample); 00056 00057 public: 00058 00059 // default is sub-gaussian 00060 IcaNet(double rate, double ax, double bx, bool superType) 00061 {learnRate=rate; superGaussian= false; w=0; dw=0; a=ax; b=bx; combined= true;} 00062 IcaNet(double rate, double ax, double bx, double cx, bool superType) 00063 {learnRate=rate; superGaussian= false; w=0; dw=0; a=ax; b=bx; c= cx; combined= false;} 00064 virtual ~IcaNet() 00065 { 00066 if( w != 0 ) 00067 { 00068 delete w; 00069 delete dw; 00070 } 00071 } 00072 00073 virtual RealVector* getW(){return w;} 00074 00075 // learning 00076 virtual void init(int size); 00077 virtual void learning(RealVector* sample, int nmax=1); 00078 00079 // out 00080 virtual double forward(RealVector* src); // maximise abslote value of kurtosis 00081 00082 virtual void output() 00083 { 00084 printf("Single ICA Net"); 00085 } 00086 }; 00087 00088 #endif