26#ifndef ROOT_TMVA_NodekNN
27#define ROOT_TMVA_NodekNN
95 void Print(std::ostream& os,
const std::string &
offset =
"")
const;
183 return fEvent.GetWeight();
217 else return Depth(node->GetNodeP()) + 1;
230 fVarDis(event.GetVar(
mod)),
240 if (fNodeL)
delete fNodeL;
241 if (fNodeR)
delete fNodeR;
253 assert(fMod ==
depth % event.GetNVar() &&
"Wrong recursive depth in Node<>::Add");
257 fVarMin = std::min(fVarMin,
value);
258 fVarMax = std::max(fVarMax,
value);
261 if (
value < fVarDis) {
264 return fNodeL->Add(event,
depth + 1);
267 fNodeL =
new Node<T>(
this, event, (
depth + 1) % event.GetNVar());
273 return fNodeR->Add(event,
depth + 1);
276 fNodeR =
new Node<T>(
this, event, (
depth + 1) % event.GetNVar());
295 os <<
offset <<
"-----------------------------------------------------------" << std::endl;
296 os <<
offset <<
"Node: mod " << fMod
298 <<
" with weight: " << GetWeight() << std::endl
302 os <<
offset <<
"Has left node " << std::endl;
305 os <<
offset <<
"Has right node" << std::endl;
309 os <<
offset <<
"PrInt_t left node " << std::endl;
310 fNodeL->Print(os,
offset +
" ");
313 os <<
offset <<
"PrInt_t right node" << std::endl;
314 fNodeR->Print(os,
offset +
" ");
317 if (!fNodeL && !fNodeR) {
336 if (!node ||
nfind < 1) {
346 if (!
nlist.empty()) {
377 std::cerr <<
"TMVA::kNN::Find() - logic error in recursive procedure" << std::endl;
445 if (!node || !(
nfind < 0.0)) {
455 if (!
nlist.empty()) {
478 else if (!
nlist.empty()) {
484 std::cerr <<
"TMVA::kNN::Find() - logic error in recursive procedure" << std::endl;
502 ncurr +=
lit -> first -> GetWeight();
508 ncurr +=
lit -> first -> GetWeight();
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
void Print(GNN_Data &d, std::string txt="")
const_iterator begin() const
const_iterator end() const
This file contains binary tree and global function template that searches tree for k-nearest neigbors...
Float_t GetVarMin() const
void SetNodeL(Node *node)
void SetNodeR(Node *node)
Double_t GetWeight() const
Float_t GetVarDis() const
Float_t GetVarMax() const
void Print(std::ostream &os, const std::string &offset="") const
const Node * GetNodeL() const
Node(const Node *parent, const T &event, Int_t mod)
const Node * GetNodeP() const
const Node & operator=(const Node &)
const Node * GetNodeR() const
const Node * Add(const T &event, UInt_t depth)
This is Node member function that adds a new node to a binary tree.
const T & GetEvent() const
kNN::Event describes point in input variable vector-space, with additional functionality like distanc...
UInt_t Find(std::list< std::pair< const Node< T > *, Float_t > > &nlist, const Node< T > *node, const T &event, UInt_t nfind)
UInt_t Depth(const Node< T > *node)
create variable transformations