Logo ROOT   6.10/09
Reference Guide
TActivationReLU.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Helge Voss
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : TActivationReLU *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Rectified linear unit function for an ANN. *
12  * *
13  * Authors (alphabetical): *
14  * Helge Voss *
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 /*! \class TMVA::TActivationReLU
25 \ingroup TMVA
26 Rectified Linear Unit activation function for TNeuron
27 */
28 
29 #include "TMVA/TActivationReLU.h"
30 
31 #include "TMVA/TActivation.h"
32 
33 #include "TFormula.h"
34 #include "TMath.h"
35 #include "TString.h"
36 
37 #include <iostream>
38 
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// constructor for ReLU
43 
45 {
46  // sorry, I really don't know what I would possibly want to do here ;)
47 
48 }
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// destructor
52 
54 {
55 }
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// get expressions for the tanh and its derivative
59 
61 {
62  TString expr = "max(0,x)";
63 
64  return expr;
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// writes the sigmoid activation function source code
69 
70 void TMVA::TActivationReLU::MakeFunction( std::ostream& fout, const TString& fncName )
71 {
72  fout << "double " << fncName << "(double x) const {" << std::endl;
73  fout << " // rectified linear unit" << std::endl;
74  fout << " return x>0 ? x : 0; " << std::endl;
75  fout << "}" << std::endl;
76 }
~TActivationReLU()
destructor
Basic string class.
Definition: TString.h:129
TString GetExpression()
get expressions for the tanh and its derivative
Rectified Linear Unit activation function for TNeuron.
#define ClassImp(name)
Definition: Rtypes.h:336
virtual void MakeFunction(std::ostream &fout, const TString &fncName)
writes the sigmoid activation function source code
Abstract ClassifierFactory template that handles arbitrary types.