Support graphviz plot for multi-target tree. (#10093)

This commit is contained in:
Jiaming Yuan
2024-03-09 05:35:25 +08:00
committed by GitHub
parent e14c3b9325
commit 2c13f90384
3 changed files with 133 additions and 63 deletions

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2014-2023 by Contributors
* Copyright 2014-2024, XGBoost Contributors
* \file tree_model.h
* \brief model structure for tree
* \author Tianqi Chen
@@ -688,6 +688,9 @@ class RegTree : public Model {
}
return (*this)[nidx].DefaultLeft();
}
[[nodiscard]] bst_node_t DefaultChild(bst_node_t nidx) const {
return this->DefaultLeft(nidx) ? this->LeftChild(nidx) : this->RightChild(nidx);
}
[[nodiscard]] bool IsRoot(bst_node_t nidx) const {
if (IsMultiTarget()) {
return nidx == kRoot;