Logo ROOT   6.08/07
Reference Guide
TActivationTanh.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Matt Jachowski
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : TMVA::TActivationTanh *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Tanh activation function for TNeuron *
12  * *
13  * Authors (alphabetical): *
14  * Matt Jachowski <jachowski@stanford.edu> - Stanford University, USA *
15  * *
16  * Copyright (c) 2005: *
17  * CERN, Switzerland *
18  * *
19  * Redistribution and use in source and binary forms, with or without *
20  * modification, are permitted according to the terms listed in LICENSE *
21  * (http://tmva.sourceforge.net/LICENSE) *
22  **********************************************************************************/
23 
24 #ifndef ROOT_TMVA_TActivationTanh
25 #define ROOT_TMVA_TActivationTanh
26 
27 //////////////////////////////////////////////////////////////////////////
28 // //
29 // TActivationTanh //
30 // //
31 // Tanh activation function for TNeuron //
32 // //
33 //////////////////////////////////////////////////////////////////////////
34 
35 #ifndef ROOT_TFormula
36 #include "TFormula.h"
37 #endif
38 #ifndef ROOT_TString
39 #include "TString.h"
40 #endif
41 
42 #ifndef ROOT_TMVA_TActivation
43 #include "TMVA/TActivation.h"
44 #endif
45 
46 namespace TMVA {
47 
48  class TActivationTanh : public TActivation {
49 
50  public:
51 
54 
55  // evaluate the activation function
56  Double_t Eval(Double_t arg);
57 
58  // evaluate the derivative of the activation function
60 
61  // minimum of the range of the activation function
62  Double_t GetMin() { return -1; }
63 
64  // maximum of the range of the activation function
65  Double_t GetMax() { return 1; }
66 
67  // expression for the activation function
69 
70  // writer of function code
71  virtual void MakeFunction(std::ostream& fout, const TString& fncName);
72 
73  void SetSlow(){fFAST=kFALSE;} // to ensure old training files will be process with old tanh code
74  private:
75  // fast tanh approximation
78 
79  ClassDef(TActivationTanh,0); // Tanh sigmoid activation function for TNeuron
80  };
81 
82 } // namespace TMVA
83 
84 #endif
Double_t fast_tanh(Double_t arg)
a fast tanh approximation
TString GetExpression()
get expressions for the tanh and its derivative whatever that may be good for ... ...
Basic string class.
Definition: TString.h:137
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TActivationTanh()
constructor for tanh sigmoid (normalized in [-1,1])
virtual void MakeFunction(std::ostream &fout, const TString &fncName)
writes the sigmoid activation function source code
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t EvalDerivative(Double_t arg)
evaluate the derivative
Double_t Eval(Double_t arg)
evaluate the tanh
~TActivationTanh()
destructor
double Double_t
Definition: RtypesCore.h:55
Abstract ClassifierFactory template that handles arbitrary types.