97 Double_t totalSquaredError = 0;
101 totalSquaredError += (*it)->getTotalError();
111 Double_t bestNodeErrorReduction = -1;
112 Node* nodeToSplit = 0;
123 if( (*it)->getErrorReduction() > bestNodeErrorReduction )
125 bestNodeErrorReduction = (*it)->getErrorReduction();
133 if(nodeToSplit == 0)
return;
193 if(left == 0 || right == 0)
return;
222 if(nextNode == 0)
return node;
240 if(left==0 || right==0)
return;
280 if(left==0 || right==0)
return;
287 std::cout <<
"ERROR: negative split variable for nonterminal node." << std::endl;
288 std::cout <<
"rankVarRecursive Split Variable = " << sv << std::endl;
310 template <
typename T>
314 std::stringstream
ss;
336 TXMLEngine* xml =
new TXMLEngine();
346 XMLDocPointer_t
xmldoc = xml->NewDoc();
347 xml->DocSetRootElement(xmldoc, root);
350 xml->SaveDoc(xmldoc, c);
353 xml->FreeDoc(xmldoc);
364 if(l==0 || r==0)
return;
367 XMLNodePointer_t left = xml->NewChild(np, 0,
"left");
368 XMLNodePointer_t right = xml->NewChild(np, 0,
"right");
384 TXMLEngine* xml =
new TXMLEngine;
387 XMLDocPointer_t
xmldoc = xml->ParseFile(filename);
395 XMLNodePointer_t mainnode = xml->DocGetRootElement(xmldoc);
401 xml->FreeDoc(xmldoc);
411 XMLAttrPointer_t attr = xml->GetFirstAttr(xnode);
412 std::vector<std::string> splitInfo(3);
413 for(
unsigned int i=0;
i<3;
i++)
415 splitInfo[
i] = xml->GetAttrValue(attr);
416 attr = xml->GetNextAttr(attr);
420 std::stringstream converter;
425 converter << splitInfo[0];
426 converter >> splitVar;
430 converter << splitInfo[1];
431 converter >> splitVal;
435 converter << splitInfo[2];
446 XMLNodePointer_t xleft = xml->GetChild(xnode);
447 XMLNodePointer_t xright = xml->GetNext(xleft);
450 if(xleft == 0 || xright == 0)
return;
Node * getRightDaughter()
Node * filterEventRecursive(Node *node, Event *e)
std::list< Node * > terminalNodes
void getSplitValues(std::vector< std::vector< Double_t >> &v)
void loadFromXMLRecursive(TXMLEngine *xml, XMLNodePointer_t node, Node *tnode)
void addXMLAttributes(TXMLEngine *xml, Node *node, XMLNodePointer_t np)
void getSplitValuesRecursive(Node *node, std::vector< std::vector< Double_t >> &v)
void rankVariables(std::vector< Double_t > &v)
void setEvents(std::vector< std::vector< emtf::Event * > > &sEvents)
void setTerminalNodes(std::list< Node * > &sTNodes)
Double_t getErrorReduction()
void setFitValue(Double_t sFitValue)
std::vector< std::vector< emtf::Event * > > & getEvents()
void setSplitVariable(Int_t sSplitVar)
void saveToXMLRecursive(TXMLEngine *xml, Node *node, XMLNodePointer_t np)
Int_t getNumTerminalNodes()
std::list< Node * > & getTerminalNodes()
void filterEventsRecursive(Node *node)
void buildTree(Int_t nodeLimit)
Node * filterEvent(Event *e)
void loadFromXML(const char *filename)
void saveToXML(const char *filename)
void setSplitValue(Double_t sSplitValue)
Node * filterEventToDaughter(emtf::Event *e)
void filterEventsToDaughters()
edm::TrieNode< PDet > Node
void rankVariablesRecursive(Node *node, std::vector< Double_t > &v)
std::string numToStr(T num)
void filterEvents(std::vector< Event * > &tEvents)
void setRootNode(Node *sRootNode)
void theMiracleOfChildBirth()