Logo ROOT  
Reference Guide
GiniIndex.h
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 : GiniIndex *
8 * Web : http://tmva.sourceforge.net *
9 * *
10 * Description: Implementation of the GiniIndex as separation criterion *
11 * Large Gini Indices (maximum 0.5) mean , that the sample is well *
12 * mixed (same amount of signal and bkg) *
13 * bkg. Small Indices mean, well separated. *
14 * general defniniton: *
15 * Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2 *
16 * Where: M is a smaple of whatever N elements (events) *
17 * that belong to K different classes *
18 * c(k) is the number of elements that belong to class k *
19 * for just Signal and Background classes this boils down to: *
20 * Gini(Sample) = 2s*b/(s+b)^2 *
21 * *
22 * *
23 * Authors (alphabetical): *
24 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
25 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
26 * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
27 * *
28 * Copyright (c) 2005: *
29 * CERN, Switzerland *
30 * U. of Victoria, Canada *
31 * Heidelberg U., Germany *
32 * *
33 * Redistribution and use in source and binary forms, with or without *
34 * modification, are permitted according to the terms listed in LICENSE *
35 * (http://ttmva.sourceforge.net/LICENSE) *
36 **********************************************************************************/
37
38#ifndef ROOT_TMVA_GiniIndex
39#define ROOT_TMVA_GiniIndex
40
41//////////////////////////////////////////////////////////////////////////
42// //
43// GiniIndex //
44// //
45// Implementation of the GiniIndex as separation criterion //
46// //
47// Large Gini Indices (maximum 0.5) mean , that the sample is well //
48// mixed (same amount of signal and bkg) //
49// bkg. Small Indices mean, well separated. //
50// general definition: //
51// Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2 //
52// Where: M is a sample of whatever N elements (events) //
53// that belong to K different classes //
54// c(k) is the number of elements that belong to class k //
55// for just Signal and Background classes this boils down to: //
56// Gini(Sample) = 2s*b/(s+b)^2 //
57//////////////////////////////////////////////////////////////////////////
58
59#include "TMVA/SeparationBase.h"
60
61namespace TMVA {
62
63 class GiniIndex : public SeparationBase {
64
65 public:
66
67 // construtor for the GiniIndex
68 GiniIndex() { fName="Gini"; }
69
70 // copy constructor
72
73 //destructor
74 virtual ~GiniIndex(){}
75
76 // Return the separation index (a measure for "purity" of the sample")
77 virtual Double_t GetSeparationIndex( const Double_t s, const Double_t b );
78
79 protected:
80
81 ClassDef(GiniIndex,0); // Implementation of the GiniIndex as separation criterion
82 };
83
84} // namespace TMVA
85
86#endif
87
#define b(i)
Definition: RSha256.hxx:100
#define g(i)
Definition: RSha256.hxx:105
double Double_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:326
Implementation of the GiniIndex as separation criterion.
Definition: GiniIndex.h:63
virtual Double_t GetSeparationIndex(const Double_t s, const Double_t b)
what we use here is 2*Gini.
Definition: GiniIndex.cxx:76
GiniIndex(const GiniIndex &g)
Definition: GiniIndex.h:71
virtual ~GiniIndex()
Definition: GiniIndex.h:74
An interface to calculate the "SeparationGain" for different separation criteria used in various trai...
static constexpr double s
create variable transformations