00001 // @(#)root/tmva $Id: TActivationTanh.h 29122 2009-06-22 06:51:30Z brun $ 00002 // Author: Matt Jachowski 00003 00004 /********************************************************************************** 00005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00006 * Package: TMVA * 00007 * Class : TMVA::TActivationTanh * 00008 * Web : http://tmva.sourceforge.net * 00009 * * 00010 * Description: * 00011 * Tanh activation function for TNeuron * 00012 * * 00013 * Authors (alphabetical): * 00014 * Matt Jachowski <jachowski@stanford.edu> - Stanford University, USA * 00015 * * 00016 * Copyright (c) 2005: * 00017 * CERN, Switzerland * 00018 * * 00019 * Redistribution and use in source and binary forms, with or without * 00020 * modification, are permitted according to the terms listed in LICENSE * 00021 * (http://tmva.sourceforge.net/LICENSE) * 00022 **********************************************************************************/ 00023 00024 #ifndef ROOT_TMVA_TActivationTanh 00025 #define ROOT_TMVA_TActivationTanh 00026 00027 ////////////////////////////////////////////////////////////////////////// 00028 // // 00029 // TActivationTanh // 00030 // // 00031 // Tanh activation function for TNeuron // 00032 // // 00033 ////////////////////////////////////////////////////////////////////////// 00034 00035 #ifndef ROOT_TFormula 00036 #include "TFormula.h" 00037 #endif 00038 #ifndef ROOT_TString 00039 #include "TString.h" 00040 #endif 00041 00042 #ifndef ROOT_TMVA_TActivation 00043 #include "TMVA/TActivation.h" 00044 #endif 00045 00046 namespace TMVA { 00047 00048 class TActivationTanh : public TActivation { 00049 00050 public: 00051 00052 TActivationTanh(); 00053 ~TActivationTanh(); 00054 00055 // evaluate the activation function 00056 Double_t Eval(Double_t arg); 00057 00058 // evaluate the derivative of the activation function 00059 Double_t EvalDerivative(Double_t arg); 00060 00061 // minimum of the range of the activation function 00062 Double_t GetMin() { return -1; } 00063 00064 // maximum of the range of the activation function 00065 Double_t GetMax() { return 1; } 00066 00067 // expression for the activation function 00068 TString GetExpression(); 00069 00070 // writer of function code 00071 virtual void MakeFunction(std::ostream& fout, const TString& fncName); 00072 00073 private: 00074 00075 TFormula* fEqn; // equation of tanh sigmoid 00076 TFormula* fEqnDerivative; // equation of tanh sigmoid derivative 00077 00078 ClassDef(TActivationTanh,0) // Tanh sigmoid activation function for TNeuron 00079 }; 00080 00081 } // namespace TMVA 00082 00083 #endif