From d3b325d02f383eb118a2e94717259a132f9913cf Mon Sep 17 00:00:00 2001 From: fis Date: Tue, 11 Jan 2022 00:35:55 +0800 Subject: [PATCH] Code comments. --- src/tree/tree_model.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tree/tree_model.cc b/src/tree/tree_model.cc index 2105e599a0a5..d78347381413 100644 --- a/src/tree/tree_model.cc +++ b/src/tree/tree_model.cc @@ -893,13 +893,13 @@ void RegTree::Save(dmlc::Stream* fo) const { } } } - +// typed array, not boolean template std::enable_if_t::value && !std::is_same::value, T> GetElem( std::vector const& arr, size_t i) { return arr[i]; } - +// typed array boolean template std::enable_if_t::value && std::is_same::value && std::is_same::value, @@ -907,7 +907,7 @@ std::enable_if_t::value && std::is_same::valu GetElem(std::vector const& arr, size_t i) { return arr[i] == 1; } - +// json array template std::enable_if_t< std::is_same::value, @@ -966,7 +966,7 @@ void RegTree::LoadCategoricalSplit(Json const& in) { ++cnt; if (cnt == categories_nodes.size()) { - last_cat_node = -1; + last_cat_node = -1; // Don't break, we still need to initialize the remaining nodes. } else { last_cat_node = GetElem(categories_nodes, cnt); } @@ -987,8 +987,8 @@ void RegTree::SaveCategoricalSplit(Json* p_out) const { I64Array categories_segments; I64Array categories_sizes; - I32Array categories; - I32Array categories_nodes; + I32Array categories; // bst_cat_t = int32_t + I32Array categories_nodes; // bst_note_t = int32_t for (size_t i = 0; i < nodes_.size(); ++i) { if (this->split_types_[i] == FeatureType::kCategorical) {