From dac0dffeb2837934647b374eab8469f91fc6a214 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 31 Oct 2021 02:31:48 +0300 Subject: [PATCH] [docs] improve docs about `nthreads` parameter (#4756) * in predict(), respect params set via `set_params()` after fit() * extract docs changes --- docs/Parameters.rst | 2 ++ include/LightGBM/config.h | 1 + python-package/lightgbm/sklearn.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/Parameters.rst b/docs/Parameters.rst index 5faa9af9fd3..088773d0690 100644 --- a/docs/Parameters.rst +++ b/docs/Parameters.rst @@ -183,6 +183,8 @@ Core Parameters - ``num_threads`` :raw-html:`🔗︎`, default = ``0``, type = int, aliases: ``num_thread``, ``nthread``, ``nthreads``, ``n_jobs`` + - used only in ``train``, ``prediction`` and ``refit`` tasks or in correspondent functions of language-specific packages + - number of threads for LightGBM - ``0`` means default number of threads in OpenMP diff --git a/include/LightGBM/config.h b/include/LightGBM/config.h index 45fffa43281..c94420645cd 100644 --- a/include/LightGBM/config.h +++ b/include/LightGBM/config.h @@ -192,6 +192,7 @@ struct Config { std::string tree_learner = "serial"; // alias = num_thread, nthread, nthreads, n_jobs + // desc = used only in ``train``, ``prediction`` and ``refit`` tasks or in correspondent functions of language-specific packages // desc = number of threads for LightGBM // desc = ``0`` means default number of threads in OpenMP // desc = for the best speed, set this to the number of **real CPU cores**, not the number of threads (most CPUs use `hyper-threading `__ to generate 2 threads per CPU core) diff --git a/python-package/lightgbm/sklearn.py b/python-package/lightgbm/sklearn.py index ac395754389..4981df873c7 100644 --- a/python-package/lightgbm/sklearn.py +++ b/python-package/lightgbm/sklearn.py @@ -434,7 +434,7 @@ def __init__( If RandomState object (numpy), a random integer is picked based on its state to seed the C++ code. If None, default seeds in C++ code are used. n_jobs : int, optional (default=-1) - Number of parallel threads. + Number of parallel threads to use for training (can be changed at prediction time). silent : bool, optional (default=True) Whether to print messages while running boosting. importance_type : str, optional (default='split')