SigmoidalNeuron.cpp

Go to the documentation of this file.
00001 #include "SigmoidalNeuron.h"
00002 #include "BipolarActivationFunction.h"
00003 #include "IdentityActivationFunction.h"
00004 
00005 namespace gplib
00006   {
00007     SigmoidalNeuron::SigmoidalNeuron(tneurontype type, bool wantcached) :
00008       Output(0.0), Delta(0.0), Net(0.0), cachedoutput(wantcached)
00009       {
00010         SetType(type);
00011       }
00012 
00013     SigmoidalNeuron::~SigmoidalNeuron()
00014       {
00015       }
00016 
00017     double SigmoidalNeuron::CalcOutput()
00018       {
00019         Net = Combiner->CalcOutput();
00020         Output = Function->CalcOutput(Net);
00021         return Output;
00022       }
00023 
00024     void SigmoidalNeuron::SetInput(
00025         const GeneralLinearCombiner::tinvector &input)
00026       {
00027         Combiner->SetInput(input);
00028       }
00029 
00030     void SigmoidalNeuron::SetType(tneurontype type)
00031       {
00032         switch (type)
00033           {
00034         case bipolar:
00035           Function = boost::shared_ptr<GeneralActivationFunction>(
00036               new BipolarActivationFunction);
00037           break;
00038         case identity:
00039           Function = boost::shared_ptr<GeneralActivationFunction>(
00040               new IdentityActivationFunction);
00041           break;
00042           }
00043         Combiner = boost::shared_ptr<GeneralLinearCombiner>(
00044             new GeneralLinearCombiner(cachedoutput));
00045       }
00046   }

Generated on Tue May 4 16:52:15 2010 for GPLIB++ by  doxygen 1.5.8