diff --git a/.readthedocs.yml b/.readthedocs.yaml
similarity index 100%
rename from .readthedocs.yml
rename to .readthedocs.yaml
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d82e8b5e6c35..109a252dfa6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -485,7 +485,7 @@ if(BUILD_CPP_TEST)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
- GIT_TAG release-1.10.0
+ GIT_TAG release-1.11.0
)
FetchContent_MakeAvailable(googletest)
add_library(GTest::GTest ALIAS gtest)
diff --git a/R-package/R/lgb.Booster.R b/R-package/R/lgb.Booster.R
index 586f3a38899d..5214118a3a42 100644
--- a/R-package/R/lgb.Booster.R
+++ b/R-package/R/lgb.Booster.R
@@ -76,6 +76,8 @@ Booster <- R6::R6Class(
stop("lgb.Booster: Can only use a string as model file path")
}
+ modelfile <- path.expand(modelfile)
+
# Create booster from model
handle <- .Call(
LGBM_BoosterCreateFromModelfile_R
@@ -425,6 +427,8 @@ Booster <- R6::R6Class(
num_iteration <- self$best_iter
}
+ filename <- path.expand(filename)
+
.Call(
LGBM_BoosterSaveModel_R
, private$handle
@@ -857,6 +861,7 @@ lgb.load <- function(filename = NULL, model_str = NULL) {
if (!is.character(filename)) {
stop("lgb.load: filename should be character")
}
+ filename <- path.expand(filename)
if (!file.exists(filename)) {
stop(sprintf("lgb.load: file '%s' passed to filename does not exist", filename))
}
@@ -917,6 +922,7 @@ lgb.save <- function(booster, filename, num_iteration = NULL) {
if (!(is.character(filename) && length(filename) == 1L)) {
stop("lgb.save: filename should be a string")
}
+ filename <- path.expand(filename)
# Store booster
return(
diff --git a/R-package/R/lgb.Dataset.R b/R-package/R/lgb.Dataset.R
index 13310ea7e3ff..f6e66908bba3 100644
--- a/R-package/R/lgb.Dataset.R
+++ b/R-package/R/lgb.Dataset.R
@@ -243,7 +243,7 @@ Dataset <- R6::R6Class(
handle <- .Call(
LGBM_DatasetCreateFromFile_R
- , private$raw_data
+ , path.expand(private$raw_data)
, params_str
, ref_handle
)
@@ -742,7 +742,7 @@ Dataset <- R6::R6Class(
.Call(
LGBM_DatasetSaveBinary_R
, private$handle
- , fname
+ , path.expand(fname)
)
return(invisible(self))
}
diff --git a/R-package/R/lgb.Predictor.R b/R-package/R/lgb.Predictor.R
index 147bed11ae7f..c27238825a17 100644
--- a/R-package/R/lgb.Predictor.R
+++ b/R-package/R/lgb.Predictor.R
@@ -35,7 +35,7 @@ Predictor <- R6::R6Class(
# Create handle on it
handle <- .Call(
LGBM_BoosterCreateFromModelfile_R
- , modelfile
+ , path.expand(modelfile)
)
private$need_free_handle <- TRUE
@@ -96,6 +96,8 @@ Predictor <- R6::R6Class(
# Check if data is a file name and not a matrix
if (identical(class(data), "character") && length(data) == 1L) {
+ data <- path.expand(data)
+
# Data is a filename, create a temporary file with a "lightgbm_" pattern in it
tmp_filename <- tempfile(pattern = "lightgbm_")
on.exit(unlink(tmp_filename), add = TRUE)
diff --git a/R-package/pkgdown/_pkgdown.yml b/R-package/pkgdown/_pkgdown.yml
index c1e591475892..b89ab96f3cd9 100644
--- a/R-package/pkgdown/_pkgdown.yml
+++ b/R-package/pkgdown/_pkgdown.yml
@@ -17,18 +17,21 @@ development:
mode: unreleased
authors:
+ Yu Shi:
+ href: https://github.com/shiyu1994
+ html: Yu Shi
Guolin Ke:
href: https://github.com/guolinke
- html: Guolin Ke
+ html: Guolin Ke
Damien Soukhavong:
href: https://github.com/Laurae2
- html: Damien Soukhavong
+ html: Damien Soukhavong
Yachen Yan:
href: https://github.com/yanyachen
- html: Yachen Yan
+ html: Yachen Yan
James Lamb:
href: https://github.com/jameslamb
- html: James Lamb
+ html: James Lamb
navbar:
title: LightGBM
diff --git a/docs/conf.py b/docs/conf.py
index 97122b0efd11..f52ac278cc8f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -221,6 +221,7 @@ def generate_doxygen_xml(app: Sphinx) -> None:
"MACRO_EXPANSION=YES",
"EXPAND_ONLY_PREDEF=NO",
"SKIP_FUNCTION_MACROS=NO",
+ "PREDEFINED=__cplusplus",
"SORT_BRIEF_DOCS=YES",
"WARN_AS_ERROR=YES",
]
diff --git a/include/LightGBM/c_api.h b/include/LightGBM/c_api.h
index b5542891b063..87e64a8ada8e 100644
--- a/include/LightGBM/c_api.h
+++ b/include/LightGBM/c_api.h
@@ -1329,19 +1329,25 @@ LIGHTGBM_C_EXPORT int LGBM_NetworkInitWithFunctions(int num_machines,
void* allgather_ext_fun);
#if !defined(__cplusplus) && (!defined(__STDC__) || (__STDC_VERSION__ < 199901L))
-#define INLINE_FUNCTION /*!< \brief inline specifier no-op in C using standards before C99. */
+/*! \brief Inline specifier no-op in C using standards before C99. */
+#define INLINE_FUNCTION
#else
-#define INLINE_FUNCTION inline /*!< \brief Inline specifier. */
+/*! \brief Inline specifier. */
+#define INLINE_FUNCTION inline
#endif
#if !defined(__cplusplus) && (!defined(__STDC__) || (__STDC_VERSION__ < 201112L))
-#define THREAD_LOCAL /*!< \brief Thread local specifier no-op in C using standards before C11. */
+/*! \brief Thread local specifier no-op in C using standards before C11. */
+#define THREAD_LOCAL
#elif !defined(__cplusplus)
-#define THREAD_LOCAL _Thread_local /*!< \brief Thread local specifier. */
+/*! \brief Thread local specifier. */
+#define THREAD_LOCAL _Thread_local
#elif defined(_MSC_VER)
-#define THREAD_LOCAL __declspec(thread) /*!< \brief Thread local specifier. */
+/*! \brief Thread local specifier. */
+#define THREAD_LOCAL __declspec(thread)
#else
-#define THREAD_LOCAL thread_local /*!< \brief Thread local specifier. */
+/*! \brief Thread local specifier. */
+#define THREAD_LOCAL thread_local
#endif
/*!
diff --git a/include/LightGBM/dataset_loader.h b/include/LightGBM/dataset_loader.h
index e72dd4910804..27bea113b052 100644
--- a/include/LightGBM/dataset_loader.h
+++ b/include/LightGBM/dataset_loader.h
@@ -67,7 +67,7 @@ class DatasetLoader {
/*! \brief Random generator*/
Random random_;
/*! \brief prediction function for initial model */
- const PredictFunction& predict_fun_;
+ const PredictFunction predict_fun_;
/*! \brief number of classes */
int num_class_;
/*! \brief index of label column */
diff --git a/python-package/lightgbm/engine.py b/python-package/lightgbm/engine.py
index 4a7b5f50ca65..aaa3e367816c 100644
--- a/python-package/lightgbm/engine.py
+++ b/python-package/lightgbm/engine.py
@@ -188,12 +188,11 @@ def train(
if num_boost_round <= 0:
raise ValueError("num_boost_round should be greater than zero.")
+ predictor: Optional[_InnerPredictor] = None
if isinstance(init_model, (str, Path)):
predictor = _InnerPredictor(model_file=init_model, pred_parameter=params)
elif isinstance(init_model, Booster):
predictor = init_model._to_predictor(dict(init_model.params, **params))
- else:
- predictor = None
init_iteration = predictor.num_total_iteration if predictor is not None else 0
# check dataset
if not isinstance(train_set, Dataset):
diff --git a/src/io/dataset_loader.cpp b/src/io/dataset_loader.cpp
index 2d2c4d622b1c..51ee7e4e540a 100644
--- a/src/io/dataset_loader.cpp
+++ b/src/io/dataset_loader.cpp
@@ -1143,7 +1143,7 @@ void DatasetLoader::ExtractFeaturesFromMemory(std::vector* text_dat
double tmp_label = 0.0f;
auto& ref_text_data = *text_data;
std::vector feature_row(dataset->num_features_);
- if (predict_fun_ == nullptr) {
+ if (!predict_fun_) {
OMP_INIT_EX();
// if doesn't need to prediction with initial model
#pragma omp parallel for schedule(static) private(oneline_features) firstprivate(tmp_label, feature_row)
@@ -1262,7 +1262,7 @@ void DatasetLoader::ExtractFeaturesFromMemory(std::vector* text_dat
void DatasetLoader::ExtractFeaturesFromFile(const char* filename, const Parser* parser,
const std::vector& used_data_indices, Dataset* dataset) {
std::vector init_score;
- if (predict_fun_ != nullptr) {
+ if (predict_fun_) {
init_score = std::vector(dataset->num_data_ * num_class_);
}
std::function&)> process_fun =