ROOT
master
Reference Guide
Loading...
Searching...
No Matches
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
* *
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
* (see tmva/doc/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
41
////////////////////////////////////////////////////////////////////////////////
42
/// Cross Entropy defined as:
43
///
44
/// -p log (p) - (1-p)log(1-p); p=purity = s/(s+b)
45
46
Double_t
TMVA::CrossEntropy::GetSeparationIndex
(
const
Double_t
s,
const
Double_t
b
)
47
{
48
if
(s+
b
<= 0)
return
0;
49
Double_t
p
= s/(s+
b
);
50
if
(
p<=0 || p >
=1)
return
0;
51
// return - ( p * log (p) + (1-p)*log(1-p) );
52
return
- (
p
*
TMath::Log2
(
p
) + (1-
p
)*
TMath::Log2
(1-
p
) );
53
}
CrossEntropy.h
b
#define b(i)
Definition
RSha256.hxx:100
p
winID h TVirtualViewer3D TVirtualGLPainter p
Definition
TGWin32VirtualGLProxy.cxx:51
TMath.h
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TMVA::CrossEntropy::GetSeparationIndex
Double_t GetSeparationIndex(const Double_t s, const Double_t b) override
Cross Entropy defined as:
Definition
CrossEntropy.cxx:46
double
TMath::Log2
Double_t Log2(Double_t x)
Returns the binary (base-2) logarithm of x.
Definition
TMath.cxx:107
tmva
tmva
src
CrossEntropy.cxx
ROOT master - Reference Guide Generated on Wed Oct 15 2025 15:09:46 (GVA Time) using Doxygen 1.10.0