From 7154e5d94a7dea4c6c12cc8321317fbe817553dd Mon Sep 17 00:00:00 2001 From: Scott Votaw Date: Thu, 1 Sep 2022 12:28:52 -0700 Subject: [PATCH] Rename num_classes to be more clear --- include/LightGBM/dataset.h | 4 ++-- src/io/metadata.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/LightGBM/dataset.h b/include/LightGBM/dataset.h index d4719ae46a1c..c60aaf037c71 100644 --- a/include/LightGBM/dataset.h +++ b/include/LightGBM/dataset.h @@ -161,7 +161,7 @@ class Metadata { * \param values Initial score values for this record, one per class */ inline void SetInitScoreAt(data_size_t idx, const double* values) { - const auto nclasses = num_classes(); + const auto nclasses = num_init_score_classes(); const double* val_ptr = values; for (int i = idx; i < nclasses * num_data_; i += num_data_, ++val_ptr) { init_score_[i] = *val_ptr; @@ -265,7 +265,7 @@ class Metadata { /*! * \brief Get number of classes */ - inline int32_t num_classes() const { + inline int32_t num_init_score_classes() const { if (num_data_ && num_init_score_) { return static_cast(num_init_score_ / num_data_); } diff --git a/src/io/metadata.cpp b/src/io/metadata.cpp index db3a9842bd44..053d1b43c104 100644 --- a/src/io/metadata.cpp +++ b/src/io/metadata.cpp @@ -62,7 +62,7 @@ void Metadata::InitByReference(data_size_t num_data, const Metadata* reference) int has_weights = reference->num_weights_ > 0; int has_init_scores = reference->num_init_score_ > 0; int has_queries = reference->num_queries_ > 0; - int nclasses = reference->num_classes(); + int nclasses = reference->num_init_score_classes(); Init(num_data, has_weights, has_init_scores, has_queries, nclasses); } @@ -361,7 +361,7 @@ void Metadata::InsertInitScores(const double* init_scores, data_size_t start_ind } if (init_score_.empty()) { init_score_.resize(num_init_score_); } - int nclasses = num_classes(); + int nclasses = num_init_score_classes(); for (int32_t col = 0; col < nclasses; ++col) { int32_t dest_offset = num_data_ * col + start_index;