TMVA::MethodKNN Class Reference

#include <MethodKNN.h>

Inheritance diagram for TMVA::MethodKNN:

TMVA::MethodBase TMVA::MethodBase TMVA::Configurable TMVA::IMethod TMVA::Configurable TMVA::IMethod TMVA::Configurable TMVA::IMethod TMVA::Configurable TMVA::IMethod List of all members.

Public Member Functions

 MethodKNN (const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="KNN", TDirectory *theTargetDir=NULL)
 MethodKNN (DataSetInfo &theData, const TString &theWeightFile, TDirectory *theTargetDir=NULL)
virtual ~MethodKNN (void)
virtual Bool_t HasAnalysisType (Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
void Train (void)
Double_t GetMvaValue (Double_t *err=0, Double_t *errUpper=0)
const std::vector< Float_t > & GetRegressionValues ()
void WriteWeightsToStream (TFile &rf) const
void AddWeightsXMLTo (void *parent) const
void ReadWeightsFromXML (void *wghtnode)
void ReadWeightsFromStream (std::istream &istr)
void ReadWeightsFromStream (TFile &rf)
const RankingCreateRanking ()
 MethodKNN (const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="KNN", TDirectory *theTargetDir=NULL)
 MethodKNN (DataSetInfo &theData, const TString &theWeightFile, TDirectory *theTargetDir=NULL)
virtual ~MethodKNN (void)
virtual Bool_t HasAnalysisType (Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
void Train (void)
Double_t GetMvaValue (Double_t *err=0, Double_t *errUpper=0)
const std::vector< Float_t > & GetRegressionValues ()
void WriteWeightsToStream (TFile &rf) const
void AddWeightsXMLTo (void *parent) const
void ReadWeightsFromXML (void *wghtnode)
void ReadWeightsFromStream (std::istream &istr)
void ReadWeightsFromStream (TFile &rf)
const RankingCreateRanking ()

Protected Member Functions

void MakeClassSpecific (std::ostream &, const TString &) const
void GetHelpMessage () const
void MakeClassSpecific (std::ostream &, const TString &) const
void GetHelpMessage () const

Private Member Functions

void DeclareOptions ()
void ProcessOptions ()
void DeclareCompatibilityOptions ()
void Init (void)
void MakeKNN (void)
Double_t PolnKernel (Double_t value) const
Double_t GausKernel (const kNN::Event &event_knn, const kNN::Event &event, const std::vector< Double_t > &svec) const
Double_t getKernelRadius (const kNN::List &rlist) const
const std::vector< Double_tgetRMS (const kNN::List &rlist, const kNN::Event &event_knn) const
double getLDAValue (const kNN::List &rlist, const kNN::Event &event_knn)
void DeclareOptions ()
void ProcessOptions ()
void DeclareCompatibilityOptions ()
void Init (void)
void MakeKNN (void)
Double_t PolnKernel (Double_t value) const
Double_t GausKernel (const kNN::Event &event_knn, const kNN::Event &event, const std::vector< Double_t > &svec) const
Double_t getKernelRadius (const kNN::List &rlist) const
const std::vector< Double_tgetRMS (const kNN::List &rlist, const kNN::Event &event_knn) const
double getLDAValue (const kNN::List &rlist, const kNN::Event &event_knn)

Private Attributes

Double_t fSumOfWeightsS
Double_t fSumOfWeightsB
kNN::ModulekNNfModule
Int_t fnkNN
 module where all work is done
Int_t fBalanceDepth
Float_t fScaleFrac
Float_t fSigmaFact
TString fKernel
Bool_t fTrim
Bool_t fUseKernel
Bool_t fUseWeight
Bool_t fUseLDA
kNN::EventVec fEvent
LDA fLDA
 (untouched) events used for learning
Int_t fTreeOptDepth
 Experimental feature for local knn analysis.
kNN::ModulekNNfModule

Detailed Description

Definition at line 60 of file MethodKNN.h.


Constructor & Destructor Documentation

TMVA::MethodKNN::MethodKNN ( const TString jobName,
const TString methodTitle,
DataSetInfo theData,
const TString theOption = "KNN",
TDirectory theTargetDir = NULL 
)

TMVA::MethodKNN::MethodKNN ( DataSetInfo theData,
const TString theWeightFile,
TDirectory theTargetDir = NULL 
)

Definition at line 78 of file MethodKNN.cxx.

TMVA::MethodKNN::~MethodKNN ( void   )  [virtual]

Definition at line 99 of file MethodKNN.cxx.

References fModule.

TMVA::MethodKNN::MethodKNN ( const TString jobName,
const TString methodTitle,
DataSetInfo theData,
const TString theOption = "KNN",
TDirectory theTargetDir = NULL 
)

TMVA::MethodKNN::MethodKNN ( DataSetInfo theData,
const TString theWeightFile,
TDirectory theTargetDir = NULL 
)

virtual TMVA::MethodKNN::~MethodKNN ( void   )  [virtual]


Member Function Documentation

Bool_t TMVA::MethodKNN::HasAnalysisType ( Types::EAnalysisType  type,
UInt_t  numberClasses,
UInt_t  numberTargets 
) [virtual]

Implements TMVA::IMethod.

Definition at line 169 of file MethodKNN.cxx.

References TMVA::Types::kClassification, kFALSE, TMVA::Types::kRegression, and kTRUE.

void TMVA::MethodKNN::Train ( void   )  [virtual]

Implements TMVA::MethodBase.

Definition at line 221 of file MethodKNN.cxx.

References TMVA::MethodBase::DataInfo(), Endl, fEvent, fScaleFrac, fSumOfWeightsB, fSumOfWeightsS, TMVA::MethodBase::GetEvent(), TMVA::MethodBase::GetNEvents(), TMVA::MethodBase::GetNVariables(), TMVA::MethodBase::IgnoreEventsWithNegWeightsInTraining(), TMVA::MethodBase::IsNormalised(), TMVA::kFATAL, TMVA::kINFO, TMVA::Configurable::Log(), MakeKNN(), and TMVA::kNN::Event::SetTargets().

Double_t TMVA::MethodKNN::GetMvaValue ( Double_t err = 0,
Double_t errUpper = 0 
) [virtual]

Implements TMVA::MethodBase.

Definition at line 280 of file MethodKNN.cxx.

References Endl, TMVA::kNN::ModulekNN::Find(), fKernel, fModule, fnkNN, fUseKernel, fUseLDA, fUseWeight, GausKernel(), TMVA::MethodBase::GetEvent(), getKernelRadius(), TMVA::kNN::ModulekNN::GetkNNList(), getLDAValue(), TMVA::kNN::Event::GetNVar(), TMVA::MethodBase::GetNVariables(), getRMS(), TMVA::Event::GetValue(), TMVA::Event::GetWeight(), TMVA::kDEBUG, TMVA::kFATAL, TMVA::kVERBOSE, TMVA::Configurable::Log(), TMVA::MethodBase::NoErrorCalc(), PolnKernel(), and TMath::Sqrt().

const std::vector< Float_t > & TMVA::MethodKNN::GetRegressionValues (  )  [virtual]

Reimplemented from TMVA::MethodBase.

Definition at line 418 of file MethodKNN.cxx.

References Endl, TMVA::kNN::ModulekNN::Find(), fModule, fnkNN, TMVA::MethodBase::fRegressionReturnVal, fUseWeight, TMVA::MethodBase::GetEvent(), TMVA::kNN::ModulekNN::GetkNNList(), TMVA::MethodBase::GetNVariables(), TMVA::Event::GetValue(), TMVA::Event::GetWeight(), TMVA::kFATAL, and TMVA::Configurable::Log().

void TMVA::MethodKNN::WriteWeightsToStream ( TFile rf  )  const

Definition at line 662 of file MethodKNN.cxx.

References TTree::Branch(), Event, fEvent, TTree::Fill(), TMVA::kINFO, TMVA::kWARNING, TMVA::Configurable::Log(), TTree::SetDirectory(), size, and TDirectoryFile::WriteTObject().

void TMVA::MethodKNN::AddWeightsXMLTo ( void *  parent  )  const [virtual]

Implements TMVA::MethodBase.

Definition at line 510 of file MethodKNN.cxx.

References TMVA::Tools::AddAttr(), TMVA::Tools::AddChild(), fEvent, TMVA::gTools(), and s.

void TMVA::MethodKNN::ReadWeightsFromXML ( void *  wghtnode  )  [virtual]

Implements TMVA::MethodBase.

Definition at line 538 of file MethodKNN.cxx.

References fEvent, TMVA::Tools::GetChild(), TMVA::Tools::GetNextChild(), TMVA::gTools(), MakeKNN(), TMVA::Tools::ReadAttr(), and s.

void TMVA::MethodKNN::ReadWeightsFromStream ( std::istream &  istr  )  [virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::ReadWeightsFromStream ( TFile rf  )  [virtual]

Reimplemented from TMVA::MethodBase.

Definition at line 697 of file MethodKNN.cxx.

References Event, fEvent, TDirectoryFile::Get(), TTree::GetEntries(), TTree::GetEntry(), i, TMVA::kFATAL, TMVA::kINFO, TMVA::Configurable::Log(), MakeKNN(), TTree::SetBranchAddress(), and size.

const TMVA::Ranking * TMVA::MethodKNN::CreateRanking (  )  [virtual]

Implements TMVA::MethodBase.

Definition at line 503 of file MethodKNN.cxx.

void TMVA::MethodKNN::MakeClassSpecific ( std::ostream &  ,
const TString  
) const [protected, virtual]

Reimplemented from TMVA::MethodBase.

Definition at line 738 of file MethodKNN.cxx.

void TMVA::MethodKNN::GetHelpMessage (  )  const [protected, virtual]

Implements TMVA::IMethod.

Definition at line 746 of file MethodKNN.cxx.

References TMVA::Tools::Color(), TMVA::gTools(), and TMVA::Configurable::Log().

void TMVA::MethodKNN::DeclareOptions (  )  [private, virtual]

Implements TMVA::MethodBase.

Definition at line 106 of file MethodKNN.cxx.

References TMVA::Configurable::DeclareOptionRef(), fBalanceDepth, fKernel, fnkNN, fScaleFrac, fSigmaFact, fTrim, fUseKernel, fUseLDA, fUseWeight, kFALSE, and kTRUE.

void TMVA::MethodKNN::ProcessOptions (  )  [private, virtual]

Implements TMVA::MethodBase.

Definition at line 138 of file MethodKNN.cxx.

References Endl, fBalanceDepth, fKernel, fnkNN, fScaleFrac, fSigmaFact, fTrim, fUseKernel, TMVA::kVERBOSE, TMVA::kWARNING, and TMVA::Configurable::Log().

void TMVA::MethodKNN::DeclareCompatibilityOptions (  )  [private, virtual]

Reimplemented from TMVA::MethodBase.

Definition at line 132 of file MethodKNN.cxx.

References TMVA::MethodBase::DeclareCompatibilityOptions(), TMVA::Configurable::DeclareOptionRef(), and fTreeOptDepth.

void TMVA::MethodKNN::Init ( void   )  [private, virtual]

Implements TMVA::MethodBase.

Definition at line 178 of file MethodKNN.cxx.

References fModule, fSumOfWeightsB, and fSumOfWeightsS.

void TMVA::MethodKNN::MakeKNN ( void   )  [private]

Definition at line 191 of file MethodKNN.cxx.

References TMVA::kNN::ModulekNN::Add(), TMVA::kNN::ModulekNN::Clear(), Endl, fBalanceDepth, fEvent, TMVA::kNN::ModulekNN::Fill(), fModule, fScaleFrac, fTrim, TMVA::kFATAL, TMVA::kINFO, TMVA::Configurable::Log(), and option.

Referenced by ReadWeightsFromStream(), ReadWeightsFromXML(), and Train().

Double_t TMVA::MethodKNN::PolnKernel ( Double_t  value  )  const [private]

Definition at line 793 of file MethodKNN.cxx.

References TMath::Abs().

Referenced by GetMvaValue().

Double_t TMVA::MethodKNN::GausKernel ( const kNN::Event event_knn,
const kNN::Event event,
const std::vector< Double_t > &  svec 
) const [private]

Definition at line 808 of file MethodKNN.cxx.

References exp(), TMVA::kNN::Event::GetNVar(), TMVA::kNN::Event::GetVar(), TMVA::kFATAL, and TMVA::Configurable::Log().

Referenced by GetMvaValue().

Double_t TMVA::MethodKNN::getKernelRadius ( const kNN::List rlist  )  const [private]

Definition at line 844 of file MethodKNN.cxx.

References fnkNN.

Referenced by GetMvaValue().

const std::vector< Double_t > TMVA::MethodKNN::getRMS ( const kNN::List rlist,
const kNN::Event event_knn 
) const [private]

Definition at line 867 of file MethodKNN.cxx.

References fnkNN, fSigmaFact, TMVA::MethodBase::GetEvent(), TMVA::kNN::Event::GetNVar(), TMVA::kNN::Event::GetVar(), TMVA::kFATAL, TMVA::Configurable::Log(), and sqrt().

Referenced by GetMvaValue().

Double_t TMVA::MethodKNN::getLDAValue ( const kNN::List rlist,
const kNN::Event event_knn 
) [private]

Definition at line 921 of file MethodKNN.cxx.

References fLDA, TMVA::LDA::GetProb(), TMVA::kNN::Event::GetVars(), TMVA::LDA::Initialize(), TMVA::kFATAL, and TMVA::Configurable::Log().

Referenced by GetMvaValue().

virtual Bool_t TMVA::MethodKNN::HasAnalysisType ( Types::EAnalysisType  type,
UInt_t  numberClasses,
UInt_t  numberTargets 
) [virtual]

Implements TMVA::IMethod.

void TMVA::MethodKNN::Train ( void   )  [virtual]

Implements TMVA::MethodBase.

Double_t TMVA::MethodKNN::GetMvaValue ( Double_t err = 0,
Double_t errUpper = 0 
) [virtual]

Implements TMVA::MethodBase.

const std::vector<Float_t>& TMVA::MethodKNN::GetRegressionValues (  )  [virtual]

Reimplemented from TMVA::MethodBase.

void TMVA::MethodKNN::WriteWeightsToStream ( TFile rf  )  const

void TMVA::MethodKNN::AddWeightsXMLTo ( void *  parent  )  const [virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::ReadWeightsFromXML ( void *  wghtnode  )  [virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::ReadWeightsFromStream ( std::istream &  istr  )  [virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::ReadWeightsFromStream ( TFile rf  )  [virtual]

Reimplemented from TMVA::MethodBase.

const Ranking* TMVA::MethodKNN::CreateRanking (  )  [virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::MakeClassSpecific ( std::ostream &  ,
const TString  
) const [protected, virtual]

Reimplemented from TMVA::MethodBase.

void TMVA::MethodKNN::GetHelpMessage (  )  const [protected, virtual]

Implements TMVA::IMethod.

void TMVA::MethodKNN::DeclareOptions (  )  [private, virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::ProcessOptions (  )  [private, virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::DeclareCompatibilityOptions (  )  [private, virtual]

Reimplemented from TMVA::MethodBase.

void TMVA::MethodKNN::Init ( void   )  [private, virtual]

Implements TMVA::MethodBase.

void TMVA::MethodKNN::MakeKNN ( void   )  [private]

Double_t TMVA::MethodKNN::PolnKernel ( Double_t  value  )  const [private]

Double_t TMVA::MethodKNN::GausKernel ( const kNN::Event event_knn,
const kNN::Event event,
const std::vector< Double_t > &  svec 
) const [private]

Double_t TMVA::MethodKNN::getKernelRadius ( const kNN::List rlist  )  const [private]

const std::vector<Double_t> TMVA::MethodKNN::getRMS ( const kNN::List rlist,
const kNN::Event event_knn 
) const [private]

double TMVA::MethodKNN::getLDAValue ( const kNN::List rlist,
const kNN::Event event_knn 
) [private]


Member Data Documentation

Double_t TMVA::MethodKNN::fSumOfWeightsS [private]

Definition at line 127 of file MethodKNN.h.

Referenced by Init(), and Train().

Double_t TMVA::MethodKNN::fSumOfWeightsB [private]

Definition at line 128 of file MethodKNN.h.

Referenced by Init(), and Train().

kNN::ModulekNN* TMVA::MethodKNN::fModule [private]

Definition at line 130 of file MethodKNN.h.

Referenced by GetMvaValue(), GetRegressionValues(), Init(), MakeKNN(), and ~MethodKNN().

Int_t TMVA::MethodKNN::fnkNN [private]

module where all work is done

Definition at line 132 of file MethodKNN.h.

Referenced by DeclareOptions(), getKernelRadius(), GetMvaValue(), GetRegressionValues(), getRMS(), and ProcessOptions().

Int_t TMVA::MethodKNN::fBalanceDepth [private]

Definition at line 133 of file MethodKNN.h.

Referenced by DeclareOptions(), MakeKNN(), and ProcessOptions().

Float_t TMVA::MethodKNN::fScaleFrac [private]

Definition at line 135 of file MethodKNN.h.

Referenced by DeclareOptions(), MakeKNN(), ProcessOptions(), and Train().

Float_t TMVA::MethodKNN::fSigmaFact [private]

Definition at line 136 of file MethodKNN.h.

Referenced by DeclareOptions(), getRMS(), and ProcessOptions().

TString TMVA::MethodKNN::fKernel [private]

Definition at line 138 of file MethodKNN.h.

Referenced by DeclareOptions(), GetMvaValue(), and ProcessOptions().

Bool_t TMVA::MethodKNN::fTrim [private]

Definition at line 140 of file MethodKNN.h.

Referenced by DeclareOptions(), MakeKNN(), and ProcessOptions().

Bool_t TMVA::MethodKNN::fUseKernel [private]

Definition at line 141 of file MethodKNN.h.

Referenced by DeclareOptions(), GetMvaValue(), and ProcessOptions().

Bool_t TMVA::MethodKNN::fUseWeight [private]

Definition at line 142 of file MethodKNN.h.

Referenced by DeclareOptions(), GetMvaValue(), and GetRegressionValues().

Bool_t TMVA::MethodKNN::fUseLDA [private]

Definition at line 143 of file MethodKNN.h.

Referenced by DeclareOptions(), and GetMvaValue().

kNN::EventVec TMVA::MethodKNN::fEvent [private]

Definition at line 145 of file MethodKNN.h.

Referenced by AddWeightsXMLTo(), MakeKNN(), ReadWeightsFromStream(), ReadWeightsFromXML(), Train(), and WriteWeightsToStream().

LDA TMVA::MethodKNN::fLDA [private]

(untouched) events used for learning

Definition at line 147 of file MethodKNN.h.

Referenced by getLDAValue().

Int_t TMVA::MethodKNN::fTreeOptDepth [private]

Experimental feature for local knn analysis.

Definition at line 150 of file MethodKNN.h.

Referenced by DeclareCompatibilityOptions().

kNN::ModulekNN* TMVA::MethodKNN::fModule [private]

Definition at line 130 of file MethodKNN.h.


The documentation for this class was generated from the following files:
Generated on Tue Jul 5 17:01:28 2011 for ROOT_528-00b_version by  doxygen 1.5.1