TarzaNN
TarzaNN neural network simulator
C:/Users/albertlr/projects/TarzaNN/TarzaNN/Neuron.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  **
00003  ** Copyright C 2002-2012 Laboratory for Active and Attentive Vision (LAAV), Department of Computer Science and Engineering, York University, Toronto, ON, Canada.
00004  ** All rights reserved.
00005  **
00006  ** This file is part of the TarzaNN Neural Network Simulator.
00007  **
00008  ** This file may be distributed and/or modified under the terms of the
00009  ** GNU General Public License version 2 as published by the Free Software
00010  ** Foundation and appearing in the file LICENSE.GPL included in the
00011  ** packaging of this file.
00012  **
00013  ** See http://www.tarzann.org/gpl/ for GPL licensing information.
00014  **
00015  ** Contact info@tarzann.org if any conditions of this licensing are
00016  ** not clear to you.
00017  **
00018  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00019  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020  **
00021  ****************************************************************************/
00022 
00023 #ifndef SIMPLE_NEURON_H_INCLUDED
00024 #define SIMPLE_NEURON_H_INCLUDED
00025 
00026 #include "FeaturePlaneAbstract.h"
00027 
00028 #define SETUP_NEURON \
00029     switch(neuronType){ \
00030     case NEURON_TYPE_WILSON_COWAN: \
00031     neuron= new WilsonCowanNeuron(); \
00032     break; \
00033     case NEURON_TYPE_ST: \
00034     neuron= new STNeuron(); \
00035     break; \
00036     case NEURON_TYPE_SPIKING: \
00037     neuron =  new SpikingNeuron(); \
00038     break; \
00039     case NEURON_TYPE_SIGMOID: \
00040     neuron =  new SigmoidNeuron(max_activation, shift, slope); \
00041     break; \
00042     case NEURON_TYPE_TANH: \
00043     neuron =  new TanHNeuron(); \
00044     break; \
00045     case NEURON_TYPE_LINEAR_SIGMOID: \
00046     neuron =  new LinearSigmoidNeuron(max_activation, rangeLow, rangeHigh); \
00047     break; \
00048     case NEURON_TYPE_LINEAR: \
00049     neuron =  new LinearNeuron(); \
00050     break; \
00051     case NEURON_TYPE_GENERIC: \
00052     neuron =  new Neuron(); \
00053     break; \
00054     default: \
00055     qDebug("invalid neuron type for FP=%s (%d)\n",name->ascii(), neuronType); \
00056     exit(-ERROR_INVALID_NEURON_TYPE); \
00057     }
00058 
00062 class Neuron{
00063 public:
00064         Neuron();
00065         virtual void nonlinearity(Matrix* totalActivation, Matrix* workOutput, Matrix* spatialBias, float featureBias);
00066         virtual double nonlinearityDerivative(double S);
00067 
00068         virtual void setFeaturePlane(FeaturePlaneAbstract* fp){
00069         theFeaturePlane=fp;
00070     }
00071         bool addActivation(int count);
00072         static int getType(const QString & name);
00073         static QString getType(int value);
00074         float getMaxActivation();
00075 
00077     static void setNeuronParams( paramMap& params,  int neuronType, float nParam1, float nParam2);
00078 
00079 protected:
00080         void processBiases(Matrix* workOutput, Matrix* spatialBias, float featureBias);
00081 
00082         FeaturePlaneAbstract* theFeaturePlane;
00084         float max_activation;
00086         float range;
00087 };
00088 #endif /*SIMPLE_NEURON_H_INCLUDED*/
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines