include/biasedcluster.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Neural Network Framework.                                                 *
00003  *  Copyright (C) 2005-2008 Gianluca Massera <emmegian@yahoo.it>              *
00004  *                                                                            *
00005  *  This program is free software; you can redistribute it and/or modify      *
00006  *  it under the terms of the GNU General Public License as published by      *
00007  *  the Free Software Foundation; either version 2 of the License, or         *
00008  *  (at your option) any later version.                                       *
00009  *                                                                            *
00010  *  This program is distributed in the hope that it will be useful,           *
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00013  *  GNU General Public License for more details.                              *
00014  *                                                                            *
00015  *  You should have received a copy of the GNU General Public License         *
00016  *  along with this program; if not, write to the Free Software               *
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA *
00018  *****************************************************************************/
00019 
00020 #ifndef BIASEDCLUSTER_H
00021 #define BIASEDCLUSTER_H
00022 
00029 #include "types.h"
00030 #include "cluster.h"
00031 #include "outputfunction.h"
00032 
00033 namespace nnfw {
00034 
00051 class NNFW_API BiasedCluster : public Cluster {
00052 public:
00055 
00058     BiasedCluster( u_int numNeurons, const char* name = "unnamed" );
00059 
00062     BiasedCluster( PropertySettings& prop );
00063 
00066     virtual ~BiasedCluster();
00067 
00069 
00071 
00074     void update();
00075 
00078     void setBias( u_int neuron, Real bias );
00079 
00082     void setAllBiases( Real bias );
00083 
00086     void setBiases( const RealVec& biases );
00087 
00090     Real getBias( u_int neuron );
00091 
00095     RealVec& biases() {
00096         return biasesdata;
00097     };
00098 
00100     Variant getBiases() {
00101         return Variant( &biasesdata );
00102     };
00103 
00105     bool setBiases( const Variant& v ) {
00106         setBiases( *( v.getRealVec() ) );
00107         return true;
00108     };
00109 
00112     void randomize( Real min, Real max );
00113 
00115     virtual BiasedCluster* clone() const;
00116 
00118 
00119 private:
00120     RealVec biasesdata;
00121     RealVec tempdata;
00122 
00124     void propdefs();
00125 };
00126 
00127 }
00128 
00129 #endif
BerliOS Developer Logo Valid XHTML 1.0 Transitional Valid CSS!