98 Node* lr = const_cast<Node*>(local_root);
107 left_new_child->
setParent(new_local_root);
109 right_new_child->setParent(new_local_root);
110 new_local_root->setLeftDaughter(left_new_child);
111 new_local_root->setRightDaughter(right_new_child);
121 return new_local_root;
127 tn.push_back(local_root);
175 double totalSquaredError = 0;
178 totalSquaredError += (*it)->getTotalError();
187 double bestNodeErrorReduction = -1;
188 Node* nodeToSplit =
nullptr;
197 if ((*it)->getErrorReduction() > bestNodeErrorReduction) {
198 bestNodeErrorReduction = (*it)->getErrorReduction();
206 if (nodeToSplit ==
nullptr)
265 if (left ==
nullptr || right ==
nullptr)
292 if (nextNode ==
nullptr)
309 if (left ==
nullptr || right ==
nullptr)
344 if (left ==
nullptr || right ==
nullptr)
351 std::cout <<
"ERROR: negative split variable for nonterminal node." << std::endl;
352 std::cout <<
"rankVarRecursive Split Variable = " <<
sv << std::endl;
370 template <
typename T>
373 std::stringstream
ss;
392 TXMLEngine* xml =
new TXMLEngine();
402 XMLDocPointer_t
xmldoc = xml->NewDoc();
419 if (
l ==
nullptr ||
r ==
nullptr)
423 XMLNodePointer_t left = xml->NewChild(
np,
nullptr,
"left");
424 XMLNodePointer_t right = xml->NewChild(
np,
nullptr,
"right");
439 TXMLEngine* xml =
new TXMLEngine;
449 XMLNodePointer_t mainnode = xml->DocGetRootElement(
xmldoc);
454 if (
std::string(
"BinaryTree") == xml->GetNodeName(mainnode)) {
455 XMLAttrPointer_t attr = xml->GetFirstAttr(mainnode);
456 attr = xml->GetNextAttr(attr);
457 boostWeight = (attr ? strtod(xml->GetAttrValue(attr),
nullptr) : 0);
459 mainnode = xml->GetChild(mainnode);
477 XMLAttrPointer_t attr = xml->GetFirstAttr(xnode);
478 std::vector<std::string> splitInfo(3);
480 for (
unsigned int i = 0,
j = 0;
i < 10;
i++) {
481 if (
i == 3 ||
i == 4 ||
i == 6) {
482 splitInfo[
j++] = xml->GetAttrValue(attr);
484 attr = xml->GetNextAttr(attr);
487 for (
unsigned int i = 0;
i < 3;
i++) {
488 splitInfo[
i] = xml->GetAttrValue(attr);
489 attr = xml->GetNextAttr(attr);
520 XMLNodePointer_t xleft = xml->GetChild(xnode);
521 XMLNodePointer_t xright = xml->GetNext(xleft);
524 if (xleft ==
nullptr || xright ==
nullptr)