Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TActivationRadial.cxx
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 : TActivationRadial *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Radial basis 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  * (http://tmva.sourceforge.net/LICENSE) *
22  **********************************************************************************/
23 
24 /*! \class TMVA::TActivationRadial
25 \ingroup TMVA
26 Radial basis activation function for ANN.
27 */
28 
29 #include "TMVA/TActivationRadial.h"
30 
31 #include "TMVA/TActivation.h"
32 
33 #include "TMath.h"
34 #include "TString.h"
35 
36 #include <iostream>
37 
38 
39 ClassImp(TMVA::TActivationRadial);
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// evaluate gaussian
43 
44 Double_t TMVA::TActivationRadial::Eval(Double_t arg)
45 {
46  return TMath::Exp(-arg * arg * 0.5);
47 }
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// evaluate derivative
51 
52 Double_t TMVA::TActivationRadial::EvalDerivative(Double_t arg)
53 {
54  return -arg*TMath::Exp(-arg * arg * 0.5);
55 }
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// get expressions for the gaussian and its derivatives
59 
60 TString TMVA::TActivationRadial::GetExpression()
61 {
62  TString expr = "TMath::Exp(-x^2/2.0)\t\t-x*TMath::Exp(-x^2/2.0)";
63  return expr;
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// writes the sigmoid activation function source code
68 
69 void TMVA::TActivationRadial::MakeFunction( std::ostream& fout, const TString& fncName )
70 {
71  fout << "double " << fncName << "(double x) const {" << std::endl;
72  fout << " // radial" << std::endl;
73  fout << " return exp(-x*x/2.0);" << std::endl;
74  fout << "}" << std::endl;
75 }