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