LightGBM icon indicating copy to clipboard operation
LightGBM copied to clipboard

LGBM_DatasetCreateFromMat question

Open limingyao001 opened this issue 1 year ago • 1 comments

I keep getting a return value of -1 when attempting to create a dataset using LGBM_DatasetCreateFromMat. My vertex_dataset is a float type vector with a length of 87,220, and vertex_labels has a length of 490. The number of features is 178, which matches the product of the number of samples and features, so the dimensions should be correct. I've also confirmed that the data is stored in row-major order. I'm unsure where the issue lies.

auto result_1 = LGBM_DatasetCreateFromMat(static_cast<void*>(vertex_dataset.data()), C_API_DTYPE_FLOAT32, int32_t(vertex_labels.size()), int32_t(featureNum * 2), 1, nullptr, nullptr, &dataset_handle);

limingyao001 avatar Jan 30 '24 08:01 limingyao001

It is mostly caused by the mis-used of this api. please refer to this test: https://github.com/microsoft/LightGBM/blob/252828fd86627d7405021c3377534d6a8239dd69/tests/c_api_test/test_.py#L124-L154

guolinke avatar Jan 30 '24 09:01 guolinke

This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM!

github-actions[bot] avatar Mar 07 '24 04:03 github-actions[bot]