38 #ifndef ROOT_TMVA_TActivationSigmoid
49 TMVA::TActivationSigmoid::TActivationSigmoid()
51 fEqn =
new TFormula(
"sigmoid",
"1.0/(1.0+TMath::Exp(-x))");
53 new TFormula(
"derivative",
"TMath::Exp(-x)/(1.0+TMath::Exp(-x))^2");
71 return fEqn->Eval(arg);
82 return fEqnDerivative->Eval(arg);
94 if (fEqn ==
NULL) expr +=
"<null>";
95 else expr += fEqn->GetExpFormula();
99 if (fEqnDerivative ==
NULL) expr +=
"<null>";
100 else expr += fEqnDerivative->GetExpFormula();
110 fout <<
"double " << fncName <<
"(double x) const {" << std::endl;
111 fout <<
" // sigmoid" << std::endl;
112 fout <<
" return 1.0/(1.0+exp(-x));" << std::endl;
113 fout <<
"}" << std::endl;
~TActivationSigmoid()
destructor
TFormula * fEqnDerivative
Double_t EvalDerivative(Double_t arg)
evaluate the derivative of the sigmoid
virtual void MakeFunction(std::ostream &fout, const TString &fncName)
writes the sigmoid activation function source code
Double_t Eval(Double_t arg)
evaluate the sigmoid
TString GetExpression()
get expressions for the sigmoid and its derivatives
ClassImp(TMVA::TActivationSigmoid) TMVA
constructor for sigmoid normalized in [0,1]
Abstract ClassifierFactory template that handles arbitrary types.
static const Int_t UNINITIALIZED