www.pudn.com > facedetectDLL_expressions.zip > classWTA.cpp


/* 
Rodney robot - Winner takes all neural net 
Copyright (C) 2002  Bob Mottram 
 
This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation; either version 2 of the License, or 
(at your option) any later version. 
 
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
GNU General Public License for more details. 
 
You should have received a copy of the GNU General Public License 
along with this program; if not, write to the Free Software 
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
 
*/ 
 
#include  
#include  
#include  
#include  
#include "classWTA.h" 
 
 
//------------------------------------------------------------------------------------------------------------------------ 
//  Constructor 
//------------------------------------------------------------------------------------------------------------------------ 
Twta::Twta (int no_of_inputs,int no_of_outputs) 
{ 
  int i,j; 
 
  NoOfInputs = no_of_inputs; 
  NoOfOutputs = no_of_outputs; 
 
  inputs = new unsigned char [NoOfInputs]; 
  average_inputs = new long[NoOfInputs]; 
  outputs = new float[NoOfOutputs]; 
  trainingInstances = 0; 
 
  weight = new float *[NoOfOutputs]; 
  salience = new float *[NoOfOutputs]; 
  for (i=0;i0) 
  { 
    for (i=0;i0) && (NoOfInputs>0)) 
  { 
 
    min=9999999; 
    winner=-1; 
    for (i=0;i