Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

AltNeuralNetI Class Reference

#include <AltNeuralNetI.h>

Inheritance diagram for AltNeuralNetI:

AltNeuralNetNcCcI AltNeuralNetStripPatternI List of all members.

Public Member Functions

 AltNeuralNetI ()
 AltNeuralNetI (const char *name, const char *title)
 AltNeuralNetI (const AltNeuralNetI &cneti)
 ~AltNeuralNetI ()
void setInputVar (std::string varName, double varValue)
double getInputVar (std::string varName)
double getTarget (void) const
void normalizeInputs (std::map< std::string, double > norm_consts)
bool isWithinLimits (void)
void copyInputsToArray (float *inputs)
void raiseSignalFlag (void)
void raiseBackgroundFlag (void)
bool isSignal (void) const
bool isBackground (void) const
void resetPattern (void)
void resetPatternValues (void)
void printI (const Option_t *opt)
int getNumberOfInputs (void) const
std::vector< std::string > getInputNames (void)

Protected Member Functions

void initPattern (const std::string *var_names, const int n_vars)

Protected Attributes

std::string fTitle
double fTarget
std::map< std::string, double > fSinglePattern

Constructor & Destructor Documentation

AltNeuralNetI::AltNeuralNetI  ) 
 

Definition at line 30 of file AltNeuralNetI.cxx.

References MSG.

00030                              :
00031 TNamed()
00032 {
00033   MSG("AltNeuralNet",Msg::kDebug) 
00034                        << "Begin of AltNeuralNetI::AltNeuralNetI() ctor" << endl;
00035   LEA_CTOR;
00036 }
//_______________________________________________________________________________

AltNeuralNetI::AltNeuralNetI const char *  name,
const char *  title
 

Definition at line 38 of file AltNeuralNetI.cxx.

References fTitle, MSG, and name.

00038                                                                   :
00039 TNamed(name, title)
00040 {
00041   MSG("AltNeuralNet",Msg::kDebug) 
00042      << "Begin of AltNeuralNetI::AltNeuralNetI(const char *, const char * ) ctor" 
00043      << endl;
00044 
00045   fTitle = std::string(title);
00046       
00047   LEA_CTOR;
00048 }
//_______________________________________________________________________________

AltNeuralNetI::AltNeuralNetI const AltNeuralNetI cneti  ) 
 

Definition at line 50 of file AltNeuralNetI.cxx.

References MSG.

00050                                                        :
00051 TNamed(cneti.GetName(), cneti.GetTitle())
00052 {
00053   MSG("AltNeuralNet",Msg::kDebug) 
00054      << "Begin of AltNeuralNetI::AltNeuralNetI(const AltNeuralNetI & cneto) ctor" 
00055      << endl;
00056          
00057   LEA_CTOR;
00058 }
//_______________________________________________________________________________

AltNeuralNetI::~AltNeuralNetI  ) 
 

Definition at line 60 of file AltNeuralNetI.cxx.

References MSG.

00061 {
00062   MSG("AltNeuralNet",Msg::kDebug) 
00063                       << "Begin of AltNeuralNetI::~AltNeuralNetI() dtor" << endl;
00064                            
00065   LEA_DTOR;
00066 }


Member Function Documentation

void AltNeuralNetI::copyInputsToArray float *  inputs  ) 
 

Definition at line 133 of file AltNeuralNetI.cxx.

References fSinglePattern.

Referenced by AltNeuralNetFunc::run().

00134 {
00135   int pos = 0;
00136   std::map<std::string, double>::iterator input_iter;
00137 
00138   for(input_iter = fSinglePattern.begin();
00139                input_iter != fSinglePattern.end(); ++input_iter) 
00140                                    inputs[pos++] = (float) (*input_iter).second;   
00141 }

std::vector< std::string > AltNeuralNetI::getInputNames void   ) 
 

Definition at line 184 of file AltNeuralNetI.cxx.

References fSinglePattern.

00185 {
00186   std::vector<std::string> names;
00187   std::map<std::string, double>::iterator input_iter;
00188   
00189   for(input_iter = fSinglePattern.begin();
00190                       input_iter != fSinglePattern.end(); ++input_iter)         
00191                                          names.push_back( (*input_iter).first );    
00192   return names;
00193 }

double AltNeuralNetI::getInputVar std::string  varName  ) 
 

Definition at line 106 of file AltNeuralNetI.cxx.

References fSinglePattern.

00107 {
00108   assert( fSinglePattern.count(varName) == 1 );
00109   std::map<std::string, double>::iterator var = fSinglePattern.find(varName);
00110   return (*var).second;      
00111 }

int AltNeuralNetI::getNumberOfInputs void   )  const
 

Definition at line 181 of file AltNeuralNetI.cxx.

References fSinglePattern.

Referenced by AltNeuralNetFunc::run().

00181                                                {
00182                                            return (int) fSinglePattern.size(); }

double AltNeuralNetI::getTarget void   )  const
 

Definition at line 113 of file AltNeuralNetI.cxx.

00113 {  return fTarget; }

void AltNeuralNetI::initPattern const std::string *  var_names,
const int  n_vars
[protected]
 

Definition at line 195 of file AltNeuralNetI.cxx.

References fSinglePattern.

Referenced by AltNeuralNetStripPatternI::AltNeuralNetStripPatternI().

00196 {
00197   for(int ivar=0; ivar<n_vars; ivar++)
00198          fSinglePattern.insert(
00199                   std::map<std::string, double>::value_type(var_names[ivar],-1));
00200 }

bool AltNeuralNetI::isBackground void   )  const
 

Definition at line 149 of file AltNeuralNetI.cxx.

References fTarget.

00149 { return fTarget == kBackground; }

bool AltNeuralNetI::isSignal void   )  const
 

Definition at line 147 of file AltNeuralNetI.cxx.

References fTarget.

00147 { return fTarget == kSignal; }

bool AltNeuralNetI::isWithinLimits void   ) 
 

Definition at line 151 of file AltNeuralNetI.cxx.

References fSinglePattern.

Referenced by normalizeInputs().

00152 {
00153   bool within_limits = true;
00154   
00155   for(std::map<std::string, double>::iterator input_iter = 
00156      fSinglePattern.begin(); input_iter != fSinglePattern.end(); ++input_iter) {
00157      
00158          within_limits = within_limits && ( (*input_iter).second >= 0. &&
00159                                             (*input_iter).second <= 1.  );
00160    }                         
00161   return within_limits;
00162 }

void AltNeuralNetI::normalizeInputs std::map< std::string, double >  norm_consts  ) 
 

Definition at line 115 of file AltNeuralNetI.cxx.

References fSinglePattern, isWithinLimits(), MSG, and printI().

00116 {
00117 // value --> norm_const * value;
00118 
00119   for(std::map<std::string, double>::iterator iterNorm = 
00120                norm_consts.begin(); iterNorm != norm_consts.end(); ++iterNorm) {
00121         
00122       assert( fSinglePattern.count( (*iterNorm).first ) == 1 );  
00123       //fSinglePattern[ (*iterNorm).first ) ] *= (*iterNorm).second;                    
00124   }
00125   
00126   if(! isWithinLimits() ) {
00127      MSG("AltNeuralNet",Msg::kWarning) 
00128                            << "Input pattern values not in [0,1] range" << endl;
00129      printI("FULL");     
00130   }
00131 }

void AltNeuralNetI::printI const Option_t *  opt  ) 
 

Definition at line 68 of file AltNeuralNetI.cxx.

References fSinglePattern, MSG, and option.

Referenced by normalizeInputs().

00069 {
00070   MSG("AltNeuralNet",Msg::kVerbose) << "Printing Neural Net Pattern" << endl;
00071   std::string option(opt);
00072   
00073   std::map<std::string, double>::iterator input_iter;
00074 
00075   if( option.find("FULL") > 0 ) {                       
00076   
00077      for( input_iter = fSinglePattern.begin(); 
00078                              input_iter != fSinglePattern.end(); ++input_iter) {
00079                  
00080          MSG("AltNeuralNet",Msg::kVerbose)
00081            << (*input_iter).first << "..............." << (*input_iter).second 
00082            << endl;
00083      }
00084   
00085   } else {
00086        std::string values = "--> ";
00087        std::ostringstream o;
00088        
00089        for(input_iter = fSinglePattern.begin(); 
00090                              input_iter != fSinglePattern.end(); ++input_iter) {
00091                  
00092            o << (*input_iter).second;
00093            values.append( o.str() ); 
00094            values += " / ";              
00095        }
00096        MSG("AltNeuralNet",Msg::kVerbose) << values << endl;
00097   }  
00098 }

void AltNeuralNetI::raiseBackgroundFlag void   ) 
 

Definition at line 145 of file AltNeuralNetI.cxx.

References fTarget.

00145 {  fTarget = kBackground;}

void AltNeuralNetI::raiseSignalFlag void   ) 
 

Definition at line 143 of file AltNeuralNetI.cxx.

References fTarget.

00143 { fTarget = kSignal;}

void AltNeuralNetI::resetPattern void   ) 
 

Definition at line 164 of file AltNeuralNetI.cxx.

References fSinglePattern.

00165 {
00166   for(std::map<std::string, double>::iterator iter = 
00167                 fSinglePattern.begin(); iter != fSinglePattern.end(); ++iter) {
00168                        
00169       fSinglePattern.erase( (*iter).first );
00170   }  
00171   assert( fSinglePattern.size() == 0);
00172 }

void AltNeuralNetI::resetPatternValues void   ) 
 

Definition at line 174 of file AltNeuralNetI.cxx.

References fSinglePattern.

00175 {
00176   for(std::map<std::string, double>::iterator iter = 
00177        fSinglePattern.begin(); iter != fSinglePattern.end(); ++iter) 
00178                                                            (*iter).second = 0.0;
00179 }

void AltNeuralNetI::setInputVar std::string  varName,
double  varValue
 

Definition at line 100 of file AltNeuralNetI.cxx.

References fSinglePattern.

00101 {
00102   assert( fSinglePattern.count(varName) == 1 );
00103   fSinglePattern[varName] = varValue;
00104 }


Member Data Documentation

std::map<std::string, double> AltNeuralNetI::fSinglePattern [protected]
 

Definition at line 67 of file AltNeuralNetI.h.

Referenced by copyInputsToArray(), getInputNames(), getInputVar(), getNumberOfInputs(), initPattern(), isWithinLimits(), normalizeInputs(), printI(), resetPattern(), resetPatternValues(), and setInputVar().

double AltNeuralNetI::fTarget [protected]
 

Definition at line 66 of file AltNeuralNetI.h.

Referenced by isBackground(), isSignal(), raiseBackgroundFlag(), and raiseSignalFlag().

std::string AltNeuralNetI::fTitle [protected]
 

Definition at line 65 of file AltNeuralNetI.h.

Referenced by AltNeuralNetI().


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:55:34 2007 for loon by  doxygen 1.3.9.1