38 #ifndef ROOT_TMVA_TActivationTanh
48 TMVA::TActivationTanh::TActivationTanh()
64 if (arg > 4.97)
return 1;
65 if (arg < -4.97)
return -1;
66 float arg2 = arg * arg;
67 float a = arg * (135135.0f + arg2 * (17325.0f + arg2 * (378.0f + arg2)));
68 float b = 135135.0f + arg2 * (62370.0f + arg2 * (3150.0f + arg2 * 28.0f));
95 TString expr =
"tanh(x)\t\t (1-tanh()^2)";
104 fout <<
"double " << fncName <<
"(double x) const {" << std::endl;
105 fout <<
" // hyperbolic tan" << std::endl;
106 fout <<
" return tanh(x);" << std::endl;
107 fout <<
"}" << std::endl;
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 ... ...
virtual void MakeFunction(std::ostream &fout, const TString &fncName)
writes the sigmoid activation function source code
ClassImp(TMVA::TActivationTanh) TMVA
constructor for tanh sigmoid (normalized in [-1,1])
Double_t EvalDerivative(Double_t arg)
evaluate the derivative
Double_t Eval(Double_t arg)
evaluate the tanh
~TActivationTanh()
destructor
Abstract ClassifierFactory template that handles arbitrary types.