ROOT
6.06/09
Reference Guide
ROOT Home Page
Main Page
Related Pages
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
tmva
tmva
src
CrossEntropy.cxx
Go to the documentation of this file.
1
// @(#)root/tmva $Id$
2
// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss
3
4
/**********************************************************************************
5
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6
* Package: TMVA *
7
* Class : TMVA::CrossEntropy *
8
* Web : http://tmva.sourceforge.net *
9
* *
10
* Description: Implementation of the CrossEntropy as separation criterion *
11
* -p log (p) - (1-p)log(1-p); p=purity *
12
* *
13
* *
14
* Authors (alphabetical): *
15
* Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
16
* Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
17
* Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
18
* *
19
* Copyright (c) 2005: *
20
* CERN, Switzerland *
21
* U. of Victoria, Canada *
22
* Heidelberg U., Germany *
23
* *
24
* Redistribution and use in source and binary forms, with or without *
25
* modification, are permitted according to the terms listed in LICENSE *
26
* (http://tmva.sourceforge.net/LICENSE) *
27
**********************************************************************************/
28
29
//_______________________________________________________________________
30
//
31
// Implementation of the CrossEntropy as separation criterion
32
// -p log (p) - (1-p)log(1-p); p=purity
33
//_______________________________________________________________________
34
35
#include "
TMath.h
"
36
#include "
TMVA/CrossEntropy.h
"
37
38
ClassImp
(
TMVA::CrossEntropy
)
39
40
////////////////////////////////////////////////////////////////////////////////
41
/// Cross Entropy defined as
42
/// -p log (p) - (1-p)log(1-p); p=purity = s/(s+b)
43
44
Double_t
TMVA
::CrossEntropy::GetSeparationIndex( const
Double_t
&s, const
Double_t
&b )
45
{
46
if
(s+b <= 0)
return
0;
47
Double_t
p = s/(s+b);
48
if
(p<=0 || p >=1)
return
0;
49
// return - ( p * log (p) + (1-p)*log(1-p) );
50
return
- ( p *
TMath::Log2
(p) + (1-p)*
TMath::Log2
(1-p) );
51
}
CrossEntropy.h
TMath::Log2
Double_t Log2(Double_t x)
Definition:
TMath.cxx:104
TMVA::CrossEntropy
Definition:
CrossEntropy.h:45
ClassImp
ClassImp(TMVA::CrossEntropy) Double_t TMVA
Cross Entropy defined as -p log (p) - (1-p)log(1-p); p=purity = s/(s+b)
Definition:
CrossEntropy.cxx:38
Double_t
double Double_t
Definition:
RtypesCore.h:55
TMVA
Abstract ClassifierFactory template that handles arbitrary types.
Definition:
MethodPyAdaBoost.h:29
TMath.h