Unverified Commit 1dbf4382 authored by Chen Yufei's avatar Chen Yufei Committed by GitHub
Browse files

Update c_api LGBM_SampleIndices() comment. (#4490)



* Update c_api LGBM_SampleIndices() comment.

rand.Sample() now returns exactly given number of samples, thus the
comment should be fixed.

* Update include/LightGBM/c_api.h
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent 75e486a6
......@@ -71,7 +71,7 @@ LIGHTGBM_C_EXPORT int LGBM_GetSampleCount(int32_t num_total_row,
* \param num_total_row Number of total rows
* \param parameters Additional parameters, namely, ``bin_construct_sample_cnt`` and ``data_random_seed`` are used to produce the output
* \param[out] out Created indices, type is int32_t
* \param[out] out_len Number of indices. This may be less than the one returned by ``LGBM_GetSampleCount``
* \param[out] out_len Number of indices
* \return 0 when succeed, -1 when failure happens
*/
LIGHTGBM_C_EXPORT int LGBM_SampleIndices(int32_t num_total_row,
......
......@@ -1223,7 +1223,8 @@ class Dataset:
ptr_data,
ctypes.byref(actual_sample_cnt),
))
return indices[:actual_sample_cnt.value]
assert sample_cnt == actual_sample_cnt.value
return indices
def _init_from_ref_dataset(self, total_nrow: int, ref_dataset: 'Dataset') -> 'Dataset':
"""Create dataset from a reference dataset.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment