// @(#)root/tmva $Id$
// Author: Matt Jachowski 

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : TMVA::TActivationChooser                                              *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Class for easily choosing activation functions.                           *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Matt Jachowski  <jachowski@stanford.edu> - Stanford University, USA       *
 *                                                                                *
 * Copyright (c) 2005:                                                            *
 *      CERN, Switzerland                                                         *
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/
 
#include "TMVA/TActivationChooser.h"


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TActivationChooser                                                   //
//                                                                      //
// Class for easily choosing activation functions                       //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include <vector>
#include "TString.h"

#ifndef ROOT_TMVA_TActivation
#include "TMVA/TActivation.h"
#endif
#ifndef ROOT_TMVA_TActivationIdentity
#include "TMVA/TActivationIdentity.h"
#endif
#ifndef ROOT_TMVA_TActivationSigmoid
#include "TMVA/TActivationSigmoid.h"
#endif
#ifndef ROOT_TMVA_TActivationTanh
#include "TMVA/TActivationTanh.h"
#endif
#ifndef ROOT_TMVA_TActivationRadial
#include "TMVA/TActivationRadial.h"
#endif
#ifndef ROOT_TMVA_MsgLogger
#include "TMVA/MsgLogger.h"
#endif


TMVA::TActivationChooser::TActivationChooser() :
   fLINEAR("linear"),
   fSIGMOID("sigmoid"),
   fTANH("tanh"),
   fRADIAL("radial"),
   fLogger( new MsgLogger("TActivationChooser") )
{
   // defaut constructor   
}

TMVA::TActivationChooser::~TActivationChooser()
{
   // destructor
   delete fLogger;
}

TMVA::TActivation*
TMVA::TActivationChooser::CreateActivation(EActivationType type) const
{
   // instantiate the correct activation object according to the
   // type choosen (given as the enumeration type)
   
   switch (type) {
   case kLinear:  return new TActivationIdentity();
   case kSigmoid: return new TActivationSigmoid(); 
   case kTanh:    return new TActivationTanh();    
   case kRadial:  return new TActivationRadial();  
   default:
      Log() << kFATAL << "no Activation function of type " << type << " found" << Endl;
      return 0; 
   }
   return NULL;
}
      
TMVA::TActivation*
TMVA::TActivationChooser::CreateActivation(const TString& type) const
{
   // instantiate the correct activation object according to the
   // type choosen (given by a TString)

   if      (type == fLINEAR)  return CreateActivation(kLinear);
   else if (type == fSIGMOID) return CreateActivation(kSigmoid);
   else if (type == fTANH)    return CreateActivation(kTanh);
   else if (type == fRADIAL)  return CreateActivation(kRadial);
   else {
      Log() << kFATAL << "no Activation function of type " << type << " found" << Endl;
      return 0;
   }
}
      
std::vector<TString>*
TMVA::TActivationChooser::GetAllActivationNames() const
{
   // retuns the names of all know activation functions

   std::vector<TString>* names = new std::vector<TString>();
   names->push_back(fLINEAR);
   names->push_back(fSIGMOID);
   names->push_back(fTANH);
   names->push_back(fRADIAL);
   return names;
}


 TActivationChooser.cxx:1
 TActivationChooser.cxx:2
 TActivationChooser.cxx:3
 TActivationChooser.cxx:4
 TActivationChooser.cxx:5
 TActivationChooser.cxx:6
 TActivationChooser.cxx:7
 TActivationChooser.cxx:8
 TActivationChooser.cxx:9
 TActivationChooser.cxx:10
 TActivationChooser.cxx:11
 TActivationChooser.cxx:12
 TActivationChooser.cxx:13
 TActivationChooser.cxx:14
 TActivationChooser.cxx:15
 TActivationChooser.cxx:16
 TActivationChooser.cxx:17
 TActivationChooser.cxx:18
 TActivationChooser.cxx:19
 TActivationChooser.cxx:20
 TActivationChooser.cxx:21
 TActivationChooser.cxx:22
 TActivationChooser.cxx:23
 TActivationChooser.cxx:24
 TActivationChooser.cxx:25
 TActivationChooser.cxx:26
 TActivationChooser.cxx:27
 TActivationChooser.cxx:28
 TActivationChooser.cxx:29
 TActivationChooser.cxx:30
 TActivationChooser.cxx:31
 TActivationChooser.cxx:32
 TActivationChooser.cxx:33
 TActivationChooser.cxx:34
 TActivationChooser.cxx:35
 TActivationChooser.cxx:36
 TActivationChooser.cxx:37
 TActivationChooser.cxx:38
 TActivationChooser.cxx:39
 TActivationChooser.cxx:40
 TActivationChooser.cxx:41
 TActivationChooser.cxx:42
 TActivationChooser.cxx:43
 TActivationChooser.cxx:44
 TActivationChooser.cxx:45
 TActivationChooser.cxx:46
 TActivationChooser.cxx:47
 TActivationChooser.cxx:48
 TActivationChooser.cxx:49
 TActivationChooser.cxx:50
 TActivationChooser.cxx:51
 TActivationChooser.cxx:52
 TActivationChooser.cxx:53
 TActivationChooser.cxx:54
 TActivationChooser.cxx:55
 TActivationChooser.cxx:56
 TActivationChooser.cxx:57
 TActivationChooser.cxx:58
 TActivationChooser.cxx:59
 TActivationChooser.cxx:60
 TActivationChooser.cxx:61
 TActivationChooser.cxx:62
 TActivationChooser.cxx:63
 TActivationChooser.cxx:64
 TActivationChooser.cxx:65
 TActivationChooser.cxx:66
 TActivationChooser.cxx:67
 TActivationChooser.cxx:68
 TActivationChooser.cxx:69
 TActivationChooser.cxx:70
 TActivationChooser.cxx:71
 TActivationChooser.cxx:72
 TActivationChooser.cxx:73
 TActivationChooser.cxx:74
 TActivationChooser.cxx:75
 TActivationChooser.cxx:76
 TActivationChooser.cxx:77
 TActivationChooser.cxx:78
 TActivationChooser.cxx:79
 TActivationChooser.cxx:80
 TActivationChooser.cxx:81
 TActivationChooser.cxx:82
 TActivationChooser.cxx:83
 TActivationChooser.cxx:84
 TActivationChooser.cxx:85
 TActivationChooser.cxx:86
 TActivationChooser.cxx:87
 TActivationChooser.cxx:88
 TActivationChooser.cxx:89
 TActivationChooser.cxx:90
 TActivationChooser.cxx:91
 TActivationChooser.cxx:92
 TActivationChooser.cxx:93
 TActivationChooser.cxx:94
 TActivationChooser.cxx:95
 TActivationChooser.cxx:96
 TActivationChooser.cxx:97
 TActivationChooser.cxx:98
 TActivationChooser.cxx:99
 TActivationChooser.cxx:100
 TActivationChooser.cxx:101
 TActivationChooser.cxx:102
 TActivationChooser.cxx:103
 TActivationChooser.cxx:104
 TActivationChooser.cxx:105
 TActivationChooser.cxx:106
 TActivationChooser.cxx:107
 TActivationChooser.cxx:108
 TActivationChooser.cxx:109
 TActivationChooser.cxx:110
 TActivationChooser.cxx:111
 TActivationChooser.cxx:112
 TActivationChooser.cxx:113
 TActivationChooser.cxx:114
 TActivationChooser.cxx:115
 TActivationChooser.cxx:116
 TActivationChooser.cxx:117
 TActivationChooser.cxx:118
 TActivationChooser.cxx:119
 TActivationChooser.cxx:120
 TActivationChooser.cxx:121