Logo ROOT   6.07/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 #include "TMVA/TActivationReLU.h"
25 
26 #include "TMVA/TActivation.h"
27 
28 #include "TFormula.h"
29 #include "TMath.h"
30 #include "TString.h"
31 
32 #include <iostream>
33 
35 
36 ////////////////////////////////////////////////////////////////////////////////
37 /// constructor for ReLU
38 
40 {
41  // sorry, I really don't know what I would possibly want to do here ;)
42 
43 }
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// destructor
47 
49 {
50 }
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// get expressions for the tanh and its derivative
54 
56 {
57  TString expr = "max(0,x)";
58 
59  return expr;
60 }
61 
62 ////////////////////////////////////////////////////////////////////////////////
63 /// writes the sigmoid activation function source code
64 
65 void TMVA::TActivationReLU::MakeFunction( std::ostream& fout, const TString& fncName )
66 {
67  fout << "double " << fncName << "(double x) const {" << std::endl;
68  fout << " // rectified linear unit" << std::endl;
69  fout << " return x>0 ? x : 0; " << std::endl;
70  fout << "}" << std::endl;
71 }
~TActivationReLU()
destructor
Basic string class.
Definition: TString.h:137
TString GetExpression()
get expressions for the tanh and its derivative
#define ClassImp(name)
Definition: Rtypes.h:279
virtual void MakeFunction(std::ostream &fout, const TString &fncName)
writes the sigmoid activation function source code
Abstract ClassifierFactory template that handles arbitrary types.