GiniIndexWithLaplace.cxx

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: GiniIndexWithLaplace.cxx 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  : TMVA::GiniIndex                                                       *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description: Implementation of the GiniIndex With Laplace correction           *
00011  *              as separation criterion                                           *
00012  *              Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2    * 
00013  *              Where: M is a smaple of whatever N elements (events)              *
00014  *                     that belong to K different classes                         *
00015  *                     c(k) is the number of elements that belong to class k      *
00016  *              Laplace's correction to the prob.density c/N --> (c+1)/(N+2)      *
00017  *              for just Signal and Background classes this then boils down to:   *
00018  *              Gini(Sample) = 2(s*b+s+b+1)/(s+b+2)^2                             *
00019  *                                                                                *
00020  * Authors (alphabetical):                                                        *
00021  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
00022  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
00023  *      Kai Voss        <Kai.Voss@cern.ch>       - U. of Victoria, Canada         *
00024  *                                                                                *
00025  * Copyright (c) 2005:                                                            *
00026  *      CERN, Switzerland                                                         * 
00027  *      U. of Victoria, Canada                                                    * 
00028  *      Heidelberg U., Germany                                                    * 
00029  *                                                                                *
00030  * Redistribution and use in source and binary forms, with or without             *
00031  * modification, are permitted according to the terms listed in LICENSE           *
00032  * (http://tmva.sourceforge.net/LICENSE)                                          *
00033  **********************************************************************************/
00034 
00035 //_______________________________________________________________________
00036 //                                                                      
00037 // Implementation of the GiniIndexWithLaplace as separation criterion              
00038 //                                                                      
00039 //_______________________________________________________________________
00040 
00041 #include "TMVA/GiniIndexWithLaplace.h"
00042 
00043 ClassImp(TMVA::GiniIndexWithLaplace)
00044 
00045 //_______________________________________________________________________
00046 Double_t TMVA::GiniIndexWithLaplace::GetSeparationIndex( const Double_t &s, const Double_t &b )
00047 {
00048    //     Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2    
00049    //              Where: M is a smaple of whatever N elements (events)              
00050    //                      that belong to K different classes                         
00051    //                      c(k) is the number of elements that belong to class k      
00052    //               Laplace's correction to the prob.density c/N --> (c+1)/(N+2)      
00053    //               for just Signal and Background classes this then boils down to:   
00054    //               Gini(Sample) = 2(s*b+s+b+1)/(s+b+2)^2                               
00055    
00056    if (s+b <= 0)      return 0;
00057    if (s<=0 || b <=0) return 0;
00058    else               return (s*b+s+b+1)/(s+b+2)/(s+b+2); 
00059 }
00060 
00061 

Generated on Tue Jul 5 15:25:00 2011 for ROOT_528-00b_version by  doxygen 1.5.1