26 #ifndef ROOT_TMVA_ModulekNN
27 #define ROOT_TMVA_ModulekNN
57 typedef std::vector<VarType> VarVec;
86 void Print(std::ostream& os)
const;
97 typedef std::vector<TMVA::kNN::Event> EventVec;
98 typedef std::pair<const Node<Event> *, VarType> Elem;
99 typedef std::list<Elem> List;
107 typedef std::map<int, std::vector<Double_t> >
VarMap;
130 const std::map<Int_t, Double_t>&
GetMetric()
const;
133 void Print(std::ostream &os)
const;
172 const VarType var2 =
GetVar(ivar);
173 return (var1 - var2) * (var1 - var2);
Event()
default constructor
const std::map< Int_t, Double_t > & GetMetric() const
Random number generator class based on M.
ModulekNN()
default constructor
const Event Scale(const Event &event) const
scale each event variable so that rms of variables is approximately 1.0 this allows comparisons of va...
This file contains binary tree and global function template that searches tree for k-nearest neigbors...
VarType GetTgt(UInt_t i) const
std::map< int, std::vector< Double_t > > VarMap
std::map< Int_t, Double_t > fVarScale
const VarVec & GetTargets() const
void SetTargets(const VarVec &tvec)
Bool_t Fill(const UShort_t odepth, UInt_t ifrac, const std::string &option="")
fill the tree
const VarVec & GetVars() const
const EventVec & GetEventVec() const
void Add(const Event &event)
add an event to tree
const VarMap & GetVarMap() const
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...
Double_t GetWeight() const
const List & GetkNNList() const
std::ostream & operator<<(std::ostream &os, const Event &event)
VarType GetDist(VarType var, UInt_t ivar) const
static TRandom3 & GetRndmThreadLocal()
ostringstream derivative to redirect and format output
VarType GetVar(UInt_t i) const
std::map< Short_t, UInt_t > fCount
Node< Event > * Optimize(UInt_t optimize_depth)
Optimize() balances binary tree for first odepth levels for each depth we split sorted depth % dimens...
const Event & GetkNNEvent() const
void ComputeMetric(UInt_t ifrac)
compute scale factor for each variable (dimension) so that distance is computed uniformly along each ...