Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:52

0001 // @(#)root/tmva $Id$
0002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss
0003 
0004 /**********************************************************************************
0005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0006  * Package: TMVA                                                                  *
0007  * Class  : GiniIndexWithLaplace                                                  *
0008  *                                             *
0009  *                                                                                *
0010  * Description: Implementation of the GiniIndex With Laplace correction           *
0011  *              as separation criterion                                           *
0012  *                                                                                *
0013  * Authors (alphabetical):                                                        *
0014  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
0015  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
0016  *      Kai Voss        <Kai.Voss@cern.ch>       - U. of Victoria, Canada         *
0017  *                                                                                *
0018  * Copyright (c) 2005:                                                            *
0019  *      CERN, Switzerland                                                         *
0020  *      U. of Victoria, Canada                                                    *
0021  *      Heidelberg U., Germany                                                    *
0022  *                                                                                *
0023  * Redistribution and use in source and binary forms, with or without             *
0024  * modification, are permitted according to the terms listed in LICENSE           *
0025  * (http://ttmva.sourceforge.net/LICENSE)                                         *
0026  **********************************************************************************/
0027 
0028 #ifndef ROOT_TMVA_GiniIndexWithLaplace
0029 #define ROOT_TMVA_GiniIndexWithLaplace
0030 
0031 //////////////////////////////////////////////////////////////////////////
0032 //                                                                      //
0033 // GiniIndexWithLaplace                                                 //
0034 //                                                                      //
0035 // Implementation of the GiniIndex With Laplace correction              //
0036 //     as separation criterion                                          //
0037 //                                                                      //
0038 //     Large Gini Indices (maximum 0.5) mean , that the sample is well  //
0039 //     mixed (same amount of signal and bkg)                            //
0040 //     bkg. Small Indices mean, well separated.                         //
0041 //     general definition:                                              //
0042 //     Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2   //
0043 //     Where: M is a sample of whatever N elements (events)             //
0044 //            that belong to K different classes                        //
0045 //            c(k) is the number of elements that belong to class k     //
0046 //     for just Signal and Background classes this boils down to:       //
0047 //     The Laplace's correction to the probability distribution would   //
0048 //       turn the c(1)/N into (c(1)+1)/(N+2)                            //
0049 //     using this the simple Gini Index  for two classes                //
0050 //               Gini(Sample) = 2s*b/(s+b)^2                            //
0051 //       turns into                                                     //
0052 //        GiniLaplace(Sample) = 2(s*b+s+b+1)/(s+b+2)^2                  //
0053 //////////////////////////////////////////////////////////////////////////
0054 
0055 #include "TMVA/SeparationBase.h"
0056 
0057 namespace TMVA {
0058 
0059    class GiniIndexWithLaplace : public SeparationBase {
0060 
0061    public:
0062 
0063       // construtor for the GiniIndexWithLaplace
0064       GiniIndexWithLaplace() { fName="GiniLaplace"; }
0065 
0066       // copy constructor
0067    GiniIndexWithLaplace( const GiniIndexWithLaplace& g): SeparationBase(g) {}
0068 
0069       //destructor
0070       virtual ~GiniIndexWithLaplace(){}
0071 
0072       // Return the separation index (a measure for "purity" of the sample")
0073       virtual Double_t GetSeparationIndex( const Double_t s, const Double_t b );
0074 
0075    protected:
0076 
0077       ClassDef(GiniIndexWithLaplace,0); // Implementation of the GiniIndexWithLaplace as separation criterion
0078    };
0079 
0080 } // namespace TMVA
0081 
0082 #endif
0083