00001 // @(#)root/tmva $Id: GiniIndex.h 29122 2009-06-22 06:51:30Z brun $ 00002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss 00003 00004 /********************************************************************************** 00005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00006 * Package: TMVA * 00007 * Class : GiniIndex * 00008 * Web : http://tmva.sourceforge.net * 00009 * * 00010 * Description: Implementation of the GiniIndex as separation criterion * 00011 * Large Gini Indices (maximum 0.5) mean , that the sample is well * 00012 * mixed (same amount of signal and bkg) * 00013 * bkg. Small Indices mean, well separated. * 00014 * general defniniton: * 00015 * Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2 * 00016 * Where: M is a smaple of whatever N elements (events) * 00017 * that belong to K different classes * 00018 * c(k) is the number of elements that belong to class k * 00019 * for just Signal and Background classes this boils down to: * 00020 * Gini(Sample) = 2s*b/(s+b)^2 * 00021 * * 00022 * * 00023 * Authors (alphabetical): * 00024 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland * 00025 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 00026 * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada * 00027 * * 00028 * Copyright (c) 2005: * 00029 * CERN, Switzerland * 00030 * U. of Victoria, Canada * 00031 * Heidelberg U., Germany * 00032 * * 00033 * Redistribution and use in source and binary forms, with or without * 00034 * modification, are permitted according to the terms listed in LICENSE * 00035 * (http://ttmva.sourceforge.net/LICENSE) * 00036 **********************************************************************************/ 00037 00038 #ifndef ROOT_TMVA_GiniIndex 00039 #define ROOT_TMVA_GiniIndex 00040 00041 ////////////////////////////////////////////////////////////////////////// 00042 // // 00043 // GiniIndex // 00044 // // 00045 // Implementation of the GiniIndex as separation criterion // 00046 // // 00047 // Large Gini Indices (maximum 0.5) mean , that the sample is well // 00048 // mixed (same amount of signal and bkg) // 00049 // bkg. Small Indices mean, well separated. // 00050 // general defniniton: // 00051 // Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2 // 00052 // Where: M is a smaple of whatever N elements (events) // 00053 // that belong to K different classes // 00054 // c(k) is the number of elements that belong to class k // 00055 // for just Signal and Background classes this boils down to: // 00056 // Gini(Sample) = 2s*b/(s+b)^2 // 00057 ////////////////////////////////////////////////////////////////////////// 00058 00059 #ifndef ROOT_TMVA_SeparationBase 00060 #include "TMVA/SeparationBase.h" 00061 #endif 00062 00063 namespace TMVA { 00064 00065 class GiniIndex : public SeparationBase { 00066 00067 public: 00068 00069 // construtor for the GiniIndex 00070 GiniIndex() { fName="Gini"; } 00071 00072 // copy constructor 00073 GiniIndex( const GiniIndex& g): SeparationBase(g) {} 00074 00075 //destructor 00076 virtual ~GiniIndex(){} 00077 00078 // Return the separation index (a measure for "purity" of the sample") 00079 virtual Double_t GetSeparationIndex( const Double_t &s, const Double_t &b ); 00080 00081 protected: 00082 00083 ClassDef(GiniIndex,0) // Implementation of the GiniIndex as separation criterion 00084 }; 00085 00086 } // namespace TMVA 00087 00088 #endif 00089