SVEvent.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: SVEvent.h 37252 2010-12-04 09:57:53Z evt $    
00002 // Author: Andrzej Zemla
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : SVEvent                                                               *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      Event class for Support Vector Machine                                    *
00012  *                                                                                *
00013  * Authors (alphabetical):                                                        *
00014  *      Marcin Wolter  <Marcin.Wolter@cern.ch> - IFJ PAN, Krakow, Poland          *
00015  *      Andrzej Zemla  <azemla@cern.ch>        - IFJ PAN, Krakow, Poland          *
00016  *      (IFJ PAN: Henryk Niewodniczanski Inst. Nucl. Physics, Krakow, Poland)     *   
00017  *                                                                                *
00018  * Copyright (c) 2005:                                                            *
00019  *      CERN, Switzerland                                                         * 
00020  *      MPI-K Heidelberg, Germany                                                 * 
00021  *      PAN, Krakow, Poland                                                       *
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://tmva.sourceforge.net/LICENSE)                                          *
00026  **********************************************************************************/
00027 
00028 #ifndef ROOT_TMVA_SVEvent
00029 #define ROOT_TMVA_SVEvent
00030 
00031 #include <vector>
00032 #include <iostream>
00033 
00034 #ifndef ROOT_Rtypes
00035 #include "Rtypes.h"
00036 #endif
00037 
00038 namespace TMVA 
00039 {
00040    class Event;
00041 
00042    class SVEvent {
00043 
00044    public:
00045 
00046       SVEvent();
00047       SVEvent( const Event*, Float_t );
00048       SVEvent( const std::vector<Float_t>*, Float_t alpha, Int_t typeFlag, UInt_t ns );
00049       SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Float_t alpha_p, Int_t typeFlag);
00050 
00051       virtual ~SVEvent();
00052 
00053       void SetAlpha        ( Float_t  alpha )      { fAlpha = alpha; }
00054       void SetAlpha_p      ( Float_t  alpha )      { fAlpha_p = alpha; }
00055       void SetErrorCache   ( Float_t  err_cache )  { fErrorCache = err_cache; }
00056       void SetIsShrinked   ( Int_t    isshrinked ) { fIsShrinked = isshrinked; }
00057       void SetLine         ( Float_t* line )       { fLine = line; } 
00058       void SetIdx          ( Int_t    idx )        { fIdx = idx; }
00059       void SetNs           ( UInt_t   ns )         { fNs = ns; }
00060       void UpdateErrorCache(Float_t upercache )    { fErrorCache += upercache; } 
00061          
00062       std::vector<Float_t>* GetDataVector() { return &fDataVector; } 
00063       Float_t  GetAlpha()         const { return fAlpha; }
00064       Float_t  GetAlpha_p()       const { return fAlpha_p; }
00065       Float_t  GetDeltaAlpha()    const { return fAlpha -  fAlpha_p; }
00066 
00067       Float_t  GetErrorCache()  const { return fErrorCache; }
00068       Int_t    GetTypeFlag()    const  { return fTypeFlag; }
00069       Int_t    GetNVar()        const  { return fNVar; }
00070       Int_t    GetIdx()         const  { return fIdx;}
00071       Float_t* GetLine()        const  { return fLine;}
00072       UInt_t   GetNs()          const  { return fNs;} 
00073       Float_t  GetCweight()     const  { return fCweight;}
00074       Float_t  GetTarget()      const  { return fTarget;}
00075       
00076       Bool_t  IsInI0a() const { return (0.< fAlpha) && (fAlpha<fCweight); }
00077       Bool_t  IsInI0b() const { return (0.< fAlpha) && (fAlpha_p<fCweight); }
00078       Bool_t  IsInI0()  const { return (IsInI0a() || IsInI0b()); } 
00079       Bool_t  IsInI1()  const { return (fAlpha == 0. && fAlpha_p == 0.); }
00080       Bool_t  IsInI2()  const { return (fAlpha == 0. && fAlpha_p == fCweight); }
00081       Bool_t  IsInI3()  const { return (fAlpha == fCweight && fAlpha_p == 0.); }
00082       
00083       void Print( std::ostream& os ) const;
00084       void PrintData();
00085 
00086    private:
00087 
00088       std::vector<Float_t> fDataVector;
00089       const Float_t        fCweight;     // svm cost weight
00090       Float_t              fAlpha;       // lagrange multiplier
00091       Float_t              fAlpha_p;     // lagrange multiplier
00092       Float_t              fErrorCache;  // optimization parameter
00093       UInt_t               fNVar;        // number of variables
00094       const Int_t          fTypeFlag;    // is sig or bkg - svm requieres 1 for sig and -1 for bkg
00095       Int_t                fIdx;         // index flag
00096       UInt_t               fNs;          // documentation
00097       Int_t                fIsShrinked;  // shrinking flag, see documentation
00098       Float_t*             fLine;        // pointer to column of kerenl matrix 
00099       const Float_t        fTarget;      // regression target
00100       
00101       ClassDef(SVEvent,0) // Event for SVM
00102    };
00103 }
00104 
00105 #endif //ROOT_TMVA_SVEvent

Generated on Tue Jul 5 14:27:38 2011 for ROOT_528-00b_version by  doxygen 1.5.1