Logo ROOT  
Reference Guide
TMVA::kNN::ModulekNN Class Reference

Definition at line 102 of file ModulekNN.h.

Public Types

typedef std::map< int, std::vector< Double_t > > VarMap
 

Public Member Functions

 ModulekNN ()
 default constructor More...
 
 ~ModulekNN ()
 destructor More...
 
void Add (const Event &event)
 add an event to tree More...
 
void Clear ()
 clean up More...
 
Bool_t Fill (const UShort_t odepth, UInt_t ifrac, const std::string &option="")
 fill the tree More...
 
Bool_t Find (Event event, UInt_t nfind=100, const std::string &option="count") const
 find in tree if tree has been filled then search for nfind closest events if metic (fVarScale map) is computed then rescale event variables using previously computed width of variable distribution More...
 
Bool_t Find (UInt_t nfind, const std::string &option) const
 find in tree More...
 
const EventVec & GetEventVec () const
 
const EventGetkNNEvent () const
 
const List & GetkNNList () const
 
const std::map< Int_t, Double_t > & GetMetric () const
 
const VarMapGetVarMap () const
 
void Print () const
 print More...
 
void Print (std::ostream &os) const
 print More...
 

Private Member Functions

void ComputeMetric (UInt_t ifrac)
 compute scale factor for each variable (dimension) so that distance is computed uniformly along each dimension compute width of interval that includes (100 - 2*ifrac)% of events below, assume that in fVar each vector of values is sorted More...
 
MsgLoggerLog () const
 
Node< Event > * Optimize (UInt_t optimize_depth)
 Optimize() balances binary tree for first odepth levels for each depth we split sorted depth % dimension variables into \( 2^{odepth} \) parts. More...
 
const Event Scale (const Event &event) const
 scale each event variable so that rms of variables is approximately 1.0 this allows comparisons of variables with distinct scales and units More...
 

Static Private Member Functions

static TRandom3GetRndmThreadLocal ()
 

Private Attributes

std::map< Short_t, UInt_tfCount
 
UInt_t fDimn
 
EventVec fEvent
 
Event fkNNEvent
 
List fkNNList
 
MsgLoggerfLogger
 
Node< Event > * fTree
 
VarMap fVar
 
std::map< Int_t, Double_tfVarScale
 

#include <TMVA/ModulekNN.h>

Member Typedef Documentation

◆ VarMap

typedef std::map<int, std::vector<Double_t> > TMVA::kNN::ModulekNN::VarMap

Definition at line 106 of file ModulekNN.h.

Constructor & Destructor Documentation

◆ ModulekNN()

TMVA::kNN::ModulekNN::ModulekNN ( )

default constructor

Definition at line 173 of file ModulekNN.cxx.

◆ ~ModulekNN()

TMVA::kNN::ModulekNN::~ModulekNN ( )

destructor

Definition at line 183 of file ModulekNN.cxx.

Member Function Documentation

◆ Add()

void TMVA::kNN::ModulekNN::Add ( const Event event)

add an event to tree

Definition at line 212 of file ModulekNN.cxx.

◆ Clear()

void TMVA::kNN::ModulekNN::Clear ( )

clean up

Definition at line 194 of file ModulekNN.cxx.

◆ ComputeMetric()

void TMVA::kNN::ModulekNN::ComputeMetric ( UInt_t  ifrac)
private

compute scale factor for each variable (dimension) so that distance is computed uniformly along each dimension compute width of interval that includes (100 - 2*ifrac)% of events below, assume that in fVar each vector of values is sorted

Definition at line 542 of file ModulekNN.cxx.

◆ Fill()

Bool_t TMVA::kNN::ModulekNN::Fill ( const UShort_t  odepth,
UInt_t  ifrac,
const std::string &  option = "" 
)

fill the tree

Definition at line 245 of file ModulekNN.cxx.

◆ Find() [1/2]

Bool_t TMVA::kNN::ModulekNN::Find ( Event  event,
UInt_t  nfind = 100,
const std::string &  option = "count" 
) const

find in tree if tree has been filled then search for nfind closest events if metic (fVarScale map) is computed then rescale event variables using previously computed width of variable distribution

Definition at line 348 of file ModulekNN.cxx.

◆ Find() [2/2]

Bool_t TMVA::kNN::ModulekNN::Find ( UInt_t  nfind,
const std::string &  option 
) const

find in tree

Definition at line 393 of file ModulekNN.cxx.

◆ GetEventVec()

const EventVec & TMVA::kNN::ModulekNN::GetEventVec ( ) const
inline

Definition at line 211 of file ModulekNN.h.

◆ GetkNNEvent()

const Event & TMVA::kNN::ModulekNN::GetkNNEvent ( ) const
inline

Definition at line 207 of file ModulekNN.h.

◆ GetkNNList()

const List & TMVA::kNN::ModulekNN::GetkNNList ( ) const
inline

Definition at line 203 of file ModulekNN.h.

◆ GetMetric()

const std::map< Int_t, Double_t > & TMVA::kNN::ModulekNN::GetMetric ( ) const
inline

Definition at line 219 of file ModulekNN.h.

◆ GetRndmThreadLocal()

static TRandom3 & TMVA::kNN::ModulekNN::GetRndmThreadLocal ( )
inlinestaticprivate

Definition at line 146 of file ModulekNN.h.

◆ GetVarMap()

const ModulekNN::VarMap & TMVA::kNN::ModulekNN::GetVarMap ( ) const
inline

Definition at line 215 of file ModulekNN.h.

◆ Log()

MsgLogger & TMVA::kNN::ModulekNN::Log ( ) const
inlineprivate

Definition at line 163 of file ModulekNN.h.

◆ Optimize()

TMVA::kNN::Node< TMVA::kNN::Event > * TMVA::kNN::ModulekNN::Optimize ( UInt_t  optimize_depth)
private

Optimize() balances binary tree for first odepth levels for each depth we split sorted depth % dimension variables into \( 2^{odepth} \) parts.

Definition at line 449 of file ModulekNN.cxx.

◆ Print() [1/2]

void TMVA::kNN::ModulekNN::Print ( ) const

print

Definition at line 662 of file ModulekNN.cxx.

◆ Print() [2/2]

void TMVA::kNN::ModulekNN::Print ( std::ostream &  os) const

print

Definition at line 670 of file ModulekNN.cxx.

◆ Scale()

const TMVA::kNN::Event TMVA::kNN::ModulekNN::Scale ( const Event event) const
private

scale each event variable so that rms of variables is approximately 1.0 this allows comparisons of variables with distinct scales and units

Definition at line 628 of file ModulekNN.cxx.

Member Data Documentation

◆ fCount

std::map<Short_t, UInt_t> TMVA::kNN::ModulekNN::fCount
private

Definition at line 157 of file ModulekNN.h.

◆ fDimn

UInt_t TMVA::kNN::ModulekNN::fDimn
private

Definition at line 148 of file ModulekNN.h.

◆ fEvent

EventVec TMVA::kNN::ModulekNN::fEvent
private

Definition at line 159 of file ModulekNN.h.

◆ fkNNEvent

Event TMVA::kNN::ModulekNN::fkNNEvent
mutableprivate

Definition at line 155 of file ModulekNN.h.

◆ fkNNList

List TMVA::kNN::ModulekNN::fkNNList
mutableprivate

Definition at line 154 of file ModulekNN.h.

◆ fLogger

MsgLogger* TMVA::kNN::ModulekNN::fLogger
mutableprivate

Definition at line 162 of file ModulekNN.h.

◆ fTree

Node<Event>* TMVA::kNN::ModulekNN::fTree
private

Definition at line 150 of file ModulekNN.h.

◆ fVar

VarMap TMVA::kNN::ModulekNN::fVar
private

Definition at line 160 of file ModulekNN.h.

◆ fVarScale

std::map<Int_t, Double_t> TMVA::kNN::ModulekNN::fVarScale
private

Definition at line 152 of file ModulekNN.h.

Libraries for TMVA::kNN::ModulekNN:
[legend]

The documentation for this class was generated from the following files: