Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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 * (see tmva/doc/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#include "TString.h"
36
37#include "TMVA/TActivation.h"
38
39namespace TMVA {
40
42
43 public:
44
47
48 // evaluate the activation function
49 Double_t Eval(Double_t arg) override;
50
51 // evaluate the derivative of the activation function
52 Double_t EvalDerivative(Double_t arg) override;
53
54 // minimum of the range of the activation function
55 Double_t GetMin() override { return -1; }
56
57 // maximum of the range of the activation function
58 Double_t GetMax() override { return 1; }
59
60 // expression for the activation function
61 TString GetExpression() override;
62
63 // writer of function code
64 void MakeFunction(std::ostream& fout, const TString& fncName) override;
65
66 void SetSlow(){fFAST=kFALSE;} // to ensure old training files will be process with old tanh code
67 private:
68 // fast tanh approximation
71
72 ClassDefOverride(TActivationTanh,0); // Tanh sigmoid activation function for TNeuron
73 };
74
75} // namespace TMVA
76
77#endif
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Tanh activation function for ANN.
Double_t Eval(Double_t arg) override
evaluate the tanh
Double_t fast_tanh(Double_t arg)
a fast tanh approximation
Double_t GetMin() override
void MakeFunction(std::ostream &fout, const TString &fncName) override
writes the Tanh sigmoid activation function source code
Double_t EvalDerivative(Double_t arg) override
evaluate the derivative
Double_t GetMax() override
TString GetExpression() override
get expressions for the tanh and its derivative whatever that may be good for ...
Interface for TNeuron activation function classes.
Definition TActivation.h:42
Basic string class.
Definition TString.h:138
create variable transformations