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