ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
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
/*! \class TMVA::CrossEntropy
30
\ingroup TMVA
31
32
Implementation of the CrossEntropy as separation criterion
33
34
-p log (p) - (1-p)log(1-p); p=purity
35
*/
36
37
#include "
TMath.h
"
38
#include "
TMVA/CrossEntropy.h
"
39
40
ClassImp(TMVA::CrossEntropy);
41
42
////////////////////////////////////////////////////////////////////////////////
43
/// Cross Entropy defined as:
44
///
45
/// -p log (p) - (1-p)log(1-p); p=purity = s/(s+b)
46
47
Double_t TMVA::CrossEntropy::GetSeparationIndex(
const
Double_t s,
const
Double_t b )
48
{
49
if
(s+b <= 0)
return
0;
50
Double_t p = s/(s+b);
51
if
(p<=0 || p >=1)
return
0;
52
// return - ( p * log (p) + (1-p)*log(1-p) );
53
return
- ( p * TMath::Log2(p) + (1-p)*TMath::Log2(1-p) );
54
}
CrossEntropy.h
TMath.h
tmva
tmva
src
CrossEntropy.cxx
Generated on Tue May 5 2020 14:03:31 for ROOT by
1.8.5